All language subtitles for 13. Challenge 3 - Solution

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
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
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

All right, so now let's solve this exercise together.

So first of all, what we want to do is to create a great variable.

So eins, great.

So just to remind you, what we want to do is that we simply want to write a program that will read

different grades, one after the other, until the user inserts a valid grade, which is which should

be between, you know, between less like greater than zero greater or equal to zero.

And of course, last van or equals to a hundred.

So until the user will not insert these grade, we will ask him to to try again.

All right.

So here we actually can use this approach.

So print half.

Answer.

Answer a grade between zero to one hundred.

Between zero to a hundred.

And we will ask the user to insert a grade.

Now we are going to read it using this kind of functional percentage, the.

And place it inside of the grade variable.

And now we are going to use, of course, the while loop to check if the grade.

That was the insert.

That is correct.

If not, we are going to ask for a new grade.

Over and over again until it's going to be correct.

So use the while and specify the while.

Loop the condition and the condition in such a case will be.

Will be.

As long as grade is less of them is less than zero or or or a logical or if as long as grade is greater

than a hundred.

So as long as one of them of these condition, either one of them is now happens to be true, we are

going to execute this loop.

And in this note, we are going to use the same, the same lines as we've used before the while loop.

So just coffee and face that you use it like this.

All right.

So print f anterograde between zero to a hundred.

We these grade until the user wheelings are the correct grade.

And once we are done out of the slope, we are going to print a corresponding message and something

like that.

Thanks.

You have inserted L.A., Jude.

At grade of the percentage there and backslash.

And at the end we are just going to specify the grade that the user inserted between zero to a hundred.

So basically this program will work and let's try to build and run it.

Let's write a bill and run it.

So let's say we are going to give it like minus five.

So it will still ask us to insert another grade, let's say a thousand.

No, they here you can see in the prompt that it asks says to anterograde between zero to hundred.

So if you want to make each correct, you should insert the grade between this range.

So in this range.

So let's try 90.

And we are getting a message, thinks you of insert that ltg the grade of 90.

All right.

So that works.

But the only thing that has not been done in these exercises, the image of do while loops.

And why would we like to to use here?

Do while loops.

Because we have a code duplication.

You can see basically that these two lines are repeated here in this loop body.

So in these type of questions, we are going in these type of cases we are going to use it to do while

as we've just explained in the previous video.

So we are just going to copy these while and the condition, put it inside after the curly brackets.

That how you use the do while loops.

And here we are going to specify that do what we want to do.

We want to run these loop body as long as these condition happens to be true.

So now, of course, we can remove these two lines.

We've eliminated the code duplication and we know that for the first time we are going to enter the

first iteration of this little body.

We are going to execute these two lines regardless of the result of this condition.

And after wars, we are going to insert these are just like we've done previously.

So just let's build in running to make sure.

Minus five.

It asks us once again, one hundred and seven again.

And if you use 50, then thinks you've answers the villager, the grade of 50.

And there you go, guys.

Basically these program works we used here do while loops instead of wire loops.

We explained why would prefer one thing over the other.

And I think we are done with this video.

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