While Loops - Up until this point everything made sense. The explanation and the examples I'll learn elsewhere | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

While Loops - Up until this point everything made sense. The explanation and the examples I'll learn elsewhere

While Loops

19th Jul 2022, 3:53 PM
Fearless Pupil
Fearless Pupil - avatar
2 Answers
+ 1
Hi! You forgot the question mark. What about while loops? You don’t understand how they works, or what? While loops loops as long as the condition in the while statments head is true. Then the lines in the while statments body executes. When the condition in the while statments head becomes false, the loops stop to excecute the line in its body. So the idea is to have some code lines in the body that affects the while statments condition. There is also a possibility to break the loop with the key word break inside the while statmwnts body. while < head >: < body …. …. …. >
19th Jul 2022, 4:16 PM
Per Bratthammar
Per Bratthammar - avatar
0
Sorry about that. The explanation and example was confusing in the lesson. The print function has always come at the end. The question to arrange the lines of code had it on the third line instead of the fourth line. The mathematics is also confusing in the lessons.
19th Jul 2022, 4:43 PM
Fearless Pupil
Fearless Pupil - avatar