All language subtitles for 13. While Loop Example with User Input

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:01,580 --> 00:00:06,080 So we had a script that checks if A is greater than 3 and prints out these operations. 1 2 00:00:06,080 --> 00:00:14,310 If that is true no let me go ahead and use a more real world example. Let's create a variable here called 2 3 00:00:14,360 --> 00:00:20,010 user name and give it a value of an empty string. 3 4 00:00:20,340 --> 00:00:30,890 And here lets check if username is different than the real user name which let's suppose it's py py. 4 5 00:00:30,910 --> 00:00:38,110 Now while that is true we want to ask the user 5 6 00:00:41,130 --> 00:00:43,580 to enter a username. 6 7 00:00:43,710 --> 00:00:46,140 So let's see what's going to happen. 7 8 00:00:46,140 --> 00:00:46,930 Enter user name. 8 9 00:00:46,930 --> 00:00:51,370 We got the prompts here by the input function py. 9 10 00:00:51,550 --> 00:00:57,820 Note we get enter user name again. Pyp maybe, no. Pypy. 10 11 00:00:58,950 --> 00:01:02,250 And so this time we don't get a prompt anymore. 11 12 00:01:02,250 --> 00:01:05,370 The execution of the program ends. 12 13 00:01:05,460 --> 00:01:07,420 So let me explain what's happened here. 13 14 00:01:07,440 --> 00:01:15,880 We declared the empty string to variable user name and then here we check if the value of the username 14 15 00:01:15,890 --> 00:01:19,260 variable is different than pypy. 15 16 00:01:19,380 --> 00:01:24,180 In this case it's different because this is an empty string and this is pypy. 16 17 00:01:24,180 --> 00:01:30,540 Therefore the first iteration will occur which is this one here. 17 18 00:01:31,110 --> 00:01:36,090 So in the first iteration we are asking the user to enter some inputs. 18 19 00:01:36,150 --> 00:01:38,700 This is what happens here in the first iteration. 19 20 00:01:38,910 --> 00:01:42,430 So enter user name was prompted and we entered pi. 20 21 00:01:42,870 --> 00:01:51,640 So pi now is the string that would the assigned to user name and the loop goes through the second iteration. 21 22 00:01:51,660 --> 00:01:59,550 So while the user name is different than pypy which is true in this case because user name for now 22 23 00:01:59,640 --> 00:02:09,320 it's py, the string py, so py is different than pypy, therefore go ahead and execute the body of the while 23 24 00:02:09,320 --> 00:02:12,230 loop again which is this one here. 24 25 00:02:12,260 --> 00:02:16,290 So ask one more time for the user name from the user. 25 26 00:02:16,480 --> 00:02:19,160 So user name the user enters pyp 26 27 00:02:19,160 --> 00:02:26,270 this time, the loop goes through the head through the beginning again and it checks if pyp is different 27 28 00:02:26,270 --> 00:02:29,030 than pypy, that's true, get the user name again. 28 29 00:02:29,030 --> 00:02:36,950 In this case we got pypy, so user name is pypy now. The loop goes again while the user name is different 29 30 00:02:36,950 --> 00:02:38,220 than pypy. 30 31 00:02:38,330 --> 00:02:52,820 In this case that is not true because in this case the user name is equal to pypy, so pypy is different 31 32 00:02:52,820 --> 00:02:53,620 than pypy. 32 33 00:02:53,630 --> 00:02:55,790 No, that's false. 33 34 00:02:55,790 --> 00:03:01,610 So the third iteration this will be equal to false, and that is when the loop ends. 34 35 00:03:01,610 --> 00:03:04,700 So for loops end when their container is exhausted. 35 36 00:03:04,970 --> 00:03:09,600 And while loops ends when the condition is false. 3663

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