Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranรฎ)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
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.