Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranî)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
In the last video, we talked about variables, what a variable is and how to declare a variable.
Now we'll go over naming conventions for variables.
Before starting, I'd like to talk a little bit about PEP, which stands for Python Enhancement Proposal,
and there are many of them.
A PIP is a document that describes new features proposed for Python and the documented aspects of Python
like design and style for the community.
For the moment, our focus is on PEP eight.
This is a document that provides guidelines and best practices on how to write Python code.
It was written in 2001 by Guido van Rossum, the author of Python and some other guys.
The primary focus of Pep eight is to improve the readability and consistency of Python code.
I recommend you to take a closer look at this document to see what its main points are.
This is really useful.
The recommendations I'll show you in this lecture.
Follow Pep eight.
In fact, I've tried to follow the guidelines provided by the document during the entire course, as
well as at my daily job when I code.
Let's move on and see some rules about naming variables.
Variable names can contain letters, digits and underscore.
For example, my underline name equals Andre age equals 40.
And they underline one equals, let's say today are all valid and recommended variable names.
A variable name can start with the number.
It can only start with an underscore or a letter.
For example, for you equals.
Thank you.
Is not a valid variable name.
This is an error.
This is not permitted in Python.
Pay attention if it starts with an underscore or double underscores, it has a special meaning to Python
and you should avoid it.
For example, underscore bonus equals 100 is a variable name but has special meaning to python and should
be avoided.
Don't use special characters in variable names like spaces, exclamation or question marks, parentheses
and so on.
For example, a exclamation mark equals eight is not permitted or a dot B equals 100.
They are not permitted.
Variable names can't be reserved words like true false non class if.
Else while.
And so on.
For example y equals ten is a syntax error while.
Is the language keyword.
It's recommended to use works written with lowercase letters separated by underscores.
Like for example, max underlined value equals 99.
By the way, this is known as Snake Case.
This is different from the camel case notation recommended in other programming languages, for example,
in Java.
The camel case notation means two group works by writing each word in the middle of the phrase with
no intervening spaces or punctuation.
For example, max permitted value equals 100.
This is camel case.
Using the camel case notation is not an error, but is not recommended.
Avoid using words that have special meanings or are already defined as data types like list, str,
set, tuple, and so on.
For example, SDR equals Python is not recommended.
There is no error.
But is not recommended.
Python is case sensitive.
It makes a distinction between lower and uppercase letters, and so are variable names.
A equals eight and the capital A equals ABC are two different variables.
Of course, you don't have to follow these conventions Exactly.
As long as you try to remain consistent within your own code.
So up next, you are going to have a quick quiz just to make sure that you have deeply understood everything
about the variables.
Good luck with the quiz and I'll see you in the next video where we'll talk about comments in Python.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.