All language subtitles for 002 Naming Conventions_en

af Afrikaans
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bn Bengali
bs Bosnian
bg Bulgarian
ca Catalan
ceb Cebuano
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
tl Filipino
fi Finnish
fr French Download
fy Frisian
gl Galician
ka Georgian
de German
el Greek
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
km Khmer
ko Korean
ku Kurdish (Kurmanji)
ky Kyrgyz
lo Lao
la Latin
lv Latvian
lt Lithuanian
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mn Mongolian
my Myanmar (Burmese)
ne Nepali
no Norwegian
ps Pashto
fa Persian
pl Polish
pt Portuguese
pa Punjabi
ro Romanian
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
st Sesotho
sn Shona
sd Sindhi
si Sinhala
sk Slovak
sl Slovenian
so Somali
es Spanish
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
te Telugu
th Thai
tr Turkish
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
or Odia (Oriya)
rw Kinyarwanda
tk Turkmen
tt Tatar
ug Uyghur
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:01,460 --> 00:00:07,850 In the last video, we talked about variables, what a variable is and how to declare a variable. 2 00:00:08,029 --> 00:00:12,320 Now we'll go over naming conventions for variables. 3 00:00:13,390 --> 00:00:20,800 Before starting, I'd like to talk a little bit about PEP, which stands for Python Enhancement Proposal, 4 00:00:20,800 --> 00:00:22,450 and there are many of them. 5 00:00:23,920 --> 00:00:32,500 A PIP is a document that describes new features proposed for Python and the documented aspects of Python 6 00:00:32,500 --> 00:00:35,380 like design and style for the community. 7 00:00:36,490 --> 00:00:39,850 For the moment, our focus is on PEP eight. 8 00:00:41,120 --> 00:00:47,300 This is a document that provides guidelines and best practices on how to write Python code. 9 00:00:47,930 --> 00:00:56,420 It was written in 2001 by Guido van Rossum, the author of Python and some other guys. 10 00:00:56,720 --> 00:01:04,550 The primary focus of Pep eight is to improve the readability and consistency of Python code. 11 00:01:06,030 --> 00:01:11,490 I recommend you to take a closer look at this document to see what its main points are. 12 00:01:11,610 --> 00:01:13,110 This is really useful. 13 00:01:16,000 --> 00:01:19,240 The recommendations I'll show you in this lecture. 14 00:01:19,240 --> 00:01:20,560 Follow Pep eight. 15 00:01:20,650 --> 00:01:27,760 In fact, I've tried to follow the guidelines provided by the document during the entire course, as 16 00:01:27,760 --> 00:01:30,610 well as at my daily job when I code. 17 00:01:32,110 --> 00:01:36,490 Let's move on and see some rules about naming variables. 18 00:01:38,260 --> 00:01:43,780 Variable names can contain letters, digits and underscore. 19 00:01:45,340 --> 00:01:53,260 For example, my underline name equals Andre age equals 40. 20 00:01:55,280 --> 00:02:04,370 And they underline one equals, let's say today are all valid and recommended variable names. 21 00:02:05,540 --> 00:02:08,660 A variable name can start with the number. 22 00:02:09,199 --> 00:02:12,710 It can only start with an underscore or a letter. 23 00:02:14,400 --> 00:02:17,550 For example, for you equals. 24 00:02:17,670 --> 00:02:18,660 Thank you. 25 00:02:20,650 --> 00:02:22,840 Is not a valid variable name. 26 00:02:23,230 --> 00:02:24,370 This is an error. 27 00:02:27,390 --> 00:02:29,430 This is not permitted in Python. 28 00:02:32,480 --> 00:02:40,130 Pay attention if it starts with an underscore or double underscores, it has a special meaning to Python 29 00:02:40,130 --> 00:02:41,510 and you should avoid it. 30 00:02:41,630 --> 00:02:50,690 For example, underscore bonus equals 100 is a variable name but has special meaning to python and should 31 00:02:50,690 --> 00:02:51,440 be avoided. 32 00:02:53,410 --> 00:03:01,270 Don't use special characters in variable names like spaces, exclamation or question marks, parentheses 33 00:03:01,270 --> 00:03:02,110 and so on. 34 00:03:03,530 --> 00:03:13,760 For example, a exclamation mark equals eight is not permitted or a dot B equals 100. 35 00:03:14,270 --> 00:03:15,620 They are not permitted. 36 00:03:20,350 --> 00:03:26,660 Variable names can't be reserved words like true false non class if. 37 00:03:26,680 --> 00:03:27,700 Else while. 38 00:03:27,700 --> 00:03:28,480 And so on. 39 00:03:28,780 --> 00:03:34,360 For example y equals ten is a syntax error while. 40 00:03:34,450 --> 00:03:35,950 Is the language keyword. 41 00:03:38,700 --> 00:03:45,710 It's recommended to use works written with lowercase letters separated by underscores. 42 00:03:45,720 --> 00:03:49,830 Like for example, max underlined value equals 99. 43 00:03:51,020 --> 00:03:54,530 By the way, this is known as Snake Case. 44 00:03:58,880 --> 00:04:05,800 This is different from the camel case notation recommended in other programming languages, for example, 45 00:04:05,800 --> 00:04:06,370 in Java. 46 00:04:07,130 --> 00:04:14,390 The camel case notation means two group works by writing each word in the middle of the phrase with 47 00:04:14,390 --> 00:04:17,839 no intervening spaces or punctuation. 48 00:04:19,370 --> 00:04:24,950 For example, max permitted value equals 100. 49 00:04:25,670 --> 00:04:27,080 This is camel case. 50 00:04:31,660 --> 00:04:37,090 Using the camel case notation is not an error, but is not recommended. 51 00:04:40,310 --> 00:04:48,590 Avoid using words that have special meanings or are already defined as data types like list, str, 52 00:04:48,590 --> 00:04:50,480 set, tuple, and so on. 53 00:04:51,650 --> 00:04:56,240 For example, SDR equals Python is not recommended. 54 00:04:57,390 --> 00:04:58,330 There is no error. 55 00:04:59,410 --> 00:05:00,850 But is not recommended. 56 00:05:02,780 --> 00:05:05,100 Python is case sensitive. 57 00:05:05,120 --> 00:05:11,600 It makes a distinction between lower and uppercase letters, and so are variable names. 58 00:05:12,560 --> 00:05:20,060 A equals eight and the capital A equals ABC are two different variables. 59 00:05:27,050 --> 00:05:30,950 Of course, you don't have to follow these conventions Exactly. 60 00:05:30,950 --> 00:05:34,790 As long as you try to remain consistent within your own code. 61 00:05:35,420 --> 00:05:41,930 So up next, you are going to have a quick quiz just to make sure that you have deeply understood everything 62 00:05:41,930 --> 00:05:43,160 about the variables. 63 00:05:43,340 --> 00:05:50,060 Good luck with the quiz and I'll see you in the next video where we'll talk about comments in Python. 5881

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.