Naming Convention & Coding Style in Python (PEP8 + Best Practices)

🎓 Welcome back to Digital Academy, the Complete Python Development Tutorial for Beginners, which will help you Learn Python from A to Z! Let’s start with the Naming Convention and Best Practices in Python (PEP8)…

🖥️ Variables Naming Convention & Coding Style in Python (PEP8 + Best Practices)

The examples you have seen so far have used short variable names. But the truth is that variable names can be more descriptive. In fact, it is usually beneficial if they are, because it makes the purpose of the variable more evident, at first glance! At least you can tell from the name what the value of the variable is supposed to represent. In this Tutorial in Python you will fond clues on How to name a variable in Python?

Officially, variable names in Python can be any length, and can consist of uppercase and lowercase letters, digits, and the underscore character. An additional restriction is that, although variable name can contain digits, the first character of a variable name cannot be one. Moreover, variables names are case-sensitive, which means that age, Age and AGE are three different variables.


For example, which of the following variable names are valid? You may have guessed right. If not, just playback and refer to the previous 5 rules, or even The Style Guide for Python Code – also known as PEP 8 – which contains Naming Conventions that list suggested standards for names, of different object types!


Plus, there is nothing stopping you from creating multiple different variables in the same program and with the same name. But it is probably ill-advised. It would certainly be likely to confuse anyone trying to read your code, and even you yourself after you had been away from it awhile!

Thus, It is worthwhile, to give a variable a name that is descriptive enough, to make clear what it is being used for. You will see later, that variables are not the only things that can be given names. Actually, you can also name: functions, classes, modules, and so on. The rules that apply to variable names also apply to identifiers.

Let’s play this video, stick around and watch until the end of this video! 👍🏻

– Digital Academy™ 🎓

***

☞ WATCH NEXT:
○ Data Types in Python – https://youtu.be/cweUByxBWiU
○ Operators in Python – https://youtu.be/-wDaVLkKOiU
○ IF Statements in Python – https://youtu.be/CC5seZ6OBJ4
○ FOR Loops in Python – https://youtu.be/JgH-D5DSTho

☞ WATCH MORE:
○ HOW TO Learn Python? Python Tutorial for Beginners [FULL Course] https://youtu.be/9hvnSZPMtuw

📖 Blog: http://digital.academy.free.fr/blog/

📖 Complete Python Development Course for Beginners [PLAYLIST]: http://digital.academy.free.fr/playlist/python-development-for-beginners

#Python #Tutorial #Beginners #Shorts

***

♡ Thanks for watching and supporting ♡
Please Subscribe. Hit the notification bell.
Like, Comment and Share.

***

♡ FOLLOW US ♡
http://digital.academy.free.fr/
https://twitter.com/DigitalAcademyy
https://www.facebook.com/digitalacademyfr
https://www.instagram.com/digital_academy_fr/
https://www.youtube.com/c/DigitalAcademyOnline

♡ SUPPORT US ♡
http://digital.academy.free.fr/join
http://digital.academy.free.fr/donate
http://digital.academy.free.fr/subscribe
https://www.patreon.com/digital_academy
https://www.buymeacoffee.com/digital_academy

***

Copy link
Powered by Social Snap