All language subtitles for 9. Conditional Explained Line by Line

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian Download
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
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
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranî)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 0 1 00:00:00,960 --> 00:00:03,690 So what is going on in this script? 1 2 00:00:03,690 --> 00:00:06,960 Let me explain this one line by line. 2 3 00:00:06,960 --> 00:00:13,220 Python executes the function definition but it doesn't do anything because it's just a function definition. 3 4 00:00:13,380 --> 00:00:19,980 Python does things when it finds a function call such as this one in here. 4 5 00:00:19,980 --> 00:00:25,980 So here we are calling the function and the input value for that function will be a Monday temperature 5 6 00:00:26,370 --> 00:00:30,060 which is equivalent to this list. 6 7 00:00:30,060 --> 00:00:36,930 So this list will go and be stored in this variable. 7 8 00:00:36,930 --> 00:00:41,540 So value is equal to this list. 8 9 00:00:41,550 --> 00:00:41,760 OK. 9 10 00:00:42,210 --> 00:00:53,510 So what happens is that the interpreter will check if the type of that list is dict. If that is true, 10 11 00:00:53,950 --> 00:00:57,030 it will execute this line here. 11 12 00:00:57,180 --> 00:00:58,860 So it will assign the 12 13 00:01:01,750 --> 00:01:06,820 outputs of this expression to the mean variable. 13 14 00:01:06,820 --> 00:01:11,840 However this is not true in this case because type of the list is not a dict. 14 15 00:01:11,890 --> 00:01:14,590 So python will not execute this line. 15 16 00:01:14,590 --> 00:01:16,840 It will go to the next line. 16 17 00:01:16,900 --> 00:01:22,510 So if that was not true then it will do this thing here. 17 18 00:01:23,170 --> 00:01:30,040 So the men will be equal to the sum of the list divided by the length of the list which is 9.26 18 19 00:01:30,040 --> 00:01:33,470 something. 19 20 00:01:33,550 --> 00:01:36,950 So this is the current value of the mean. 20 21 00:01:37,060 --> 00:01:41,830 Therefore here the indentation ends. 21 22 00:01:41,950 --> 00:01:49,870 So return is outside of the if and else block you can see here, it has to be outside. 22 23 00:01:50,140 --> 00:01:57,430 So the conditional block ends here and the current value of the mean will be returned by the return 23 24 00:01:57,640 --> 00:02:00,310 statement. 24 25 00:02:00,310 --> 00:02:05,120 So you get that mean value for 25 26 00:02:05,130 --> 00:02:06,840 that list. 26 27 00:02:06,910 --> 00:02:15,100 If this was student grades instead what happens is that this dictionary will be stored in value and 27 28 00:02:15,130 --> 00:02:16,720 if type of value is dict. 28 29 00:02:16,750 --> 00:02:17,800 Yes it's a dict. 29 30 00:02:17,950 --> 00:02:20,620 The men will be equal to that. 30 31 00:02:21,140 --> 00:02:24,030 So to the mean of the dictionary. 31 32 00:02:24,280 --> 00:02:33,090 And if this condition is true this is executed and python will ignore everything that is under else. 32 33 00:02:33,370 --> 00:02:40,100 I said everything that is under else which means everything that is indented under else. 33 34 00:02:40,210 --> 00:02:42,060 So the children of else 34 35 00:02:42,160 --> 00:02:47,950 So to say, return of the mean is not a child of else, it's not indented under else. 35 36 00:02:47,950 --> 00:02:49,520 It's independents. 36 37 00:02:49,570 --> 00:02:52,060 It has its own indentation level. 37 38 00:02:52,060 --> 00:02:58,810 So therefore the current value of the mean is this one in here, so return to the mean will actually 38 39 00:02:58,810 --> 00:03:04,640 return the mean for the dictionary, that one in there. 3648

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