+ 5

What is while loop?

I'm not understanding while loop . I think it's complicated . I 'm also new to programming and python but I've tried c .

6th Jun 2017, 7:42 AM
Tarif Aziz
Tarif Aziz - avatar
4 odpowiedzi
+ 12
The while loop is used to repeat a section of code an unknown number of times until a specific condition is met. For example, say we want to know how many times a given number can be divided by 2 before it is less than or equal to 1. If we know a specific number, such as 32, we can say 5 times, but for a given symbolic variable "NUMBER" which represents any number in the world, how many times is notknown a priori (before hand).  more details : http://www.cs.utah.edu/~germain/PPS/Topics/while_loops.html
6th Jun 2017, 7:59 AM
Art456
Art456 - avatar
+ 5
you can think about them as if statements its like present and present progressive in grammar : if you expect your if expressions to change , you use a while loop to make sure your lines runs only when a certain condition is satisfied or only when a certain condition is not present .
6th Jun 2017, 2:23 PM
Hasan Fares
Hasan Fares - avatar
+ 3
thank you
6th Jun 2017, 2:33 PM
Tarif Aziz
Tarif Aziz - avatar
+ 2
thank you
6th Jun 2017, 8:04 AM
Tarif Aziz
Tarif Aziz - avatar