All language subtitles for 7. If Conditional Example

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

Original subtitles

0 This function returns the mean value of a list, but we want to make it more intelligence. 1

We want the function to return to the mean even if the input value is a dictionary. 2

So when the input value is a list it will going to apply a specific algorithm and return the specific 3

value which is the mean of a list. When it's a dictionary 4

it's going to check if it's a dictionary and apply the corresponding algorithm that calculates the mean 5

value of a dictionary. 6

So we know that 7

sum(monday_temperatures) divided by length of monday_temperatures gives you the mean of the list. 8

Similarly student grades which is a dictionary, it's values, the sum of its values divided by the length 9

of student grades dictionary will give you that mean. 10

So we want our function to check and make a decision. 11

This is a parameter. 12

Let me change it to value. 13

Value is a more meaningful name since what we are processing we will not only be a list but it can 14

also be a dictionary. 15

And then under the function everything has to be indented. 16

You can see the whole body of the function is indented. 17

So the conditional block that I'm going to write here is also going to be indented. 18

It starts with if. If you remember we used a type function earlier in the course which returned the type 19

of an object. 20

For example this is a dictionary, an empty one, but it's still a dictionary. 21

So what you can do here is you can say if type value. 22

Double assignment operator which means equal. 23

It's a comparison operator. 24

It checks equality. If that is a dict, a column, enter and it has to be indented with four spaces. 25

So you see it's another level of indentation it's one here for if, and this is for the function, so here 26

the mean will be equal to sum of value 27

dot values 28

divided by the length of value. 29

So this is a dictionary dict.values and length of the dictionary. 30

I have to close the sum function call there like that and enter. 31

If you are done with 32

the if block, 33

so if that's all what you want to check then you say else 34

and we have this code which has to be indented under else as well and that's it. 35

Let me try this. So with student grades, the dictionary as input 36

we got these value here. 37

If I used 38

the list 39

monday_temperatures it's going to give me the other value which is the meaning of the Monday temperatures. 40

So that's an if and else conditional. 41

But let me explain it line by line in the next video.

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