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
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 So we had a script that checks if A is greater than 3 and prints out these operations. 1

If that is true no let me go ahead and use a more real world example. Let's create a variable here called 2

user name and give it a value of an empty string. 3

And here lets check if username is different than the real user name which let's suppose it's py py. 4

Now while that is true we want to ask the user 5

to enter a username. 6

So let's see what's going to happen. 7

Enter user name. 8

We got the prompts here by the input function py. 9

Note we get enter user name again. Pyp maybe, no. Pypy. 10

And so this time we don't get a prompt anymore. 11

The execution of the program ends. 12

So let me explain what's happened here. 13

We declared the empty string to variable user name and then here we check if the value of the username 14

variable is different than pypy. 15

In this case it's different because this is an empty string and this is pypy. 16

Therefore the first iteration will occur which is this one here. 17

So in the first iteration we are asking the user to enter some inputs. 18

This is what happens here in the first iteration. 19

So enter user name was prompted and we entered pi. 20

So pi now is the string that would the assigned to user name and the loop goes through the second iteration. 21

So while the user name is different than pypy which is true in this case because user name for now 22

it's py, the string py, so py is different than pypy, therefore go ahead and execute the body of the while 23

loop again which is this one here. 24

So ask one more time for the user name from the user. 25

So user name the user enters pyp 26

this time, the loop goes through the head through the beginning again and it checks if pyp is different 27

than pypy, that's true, get the user name again. 28

In this case we got pypy, so user name is pypy now. The loop goes again while the user name is different 29

than pypy. 30

In this case that is not true because in this case the user name is equal to pypy, so pypy is different 31

than pypy. 32

No, that's false. 33

So the third iteration this will be equal to false, and that is when the loop ends. 34

So for loops end when their container is exhausted. 35

And while loops ends when the condition is false.

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