In python , there are two type of loops-
- for loop
- while loop
while loop are simple loop which run until the condition will not become false
Syntax :-
while(condition):
body of while
program -
i=20
print("While loop start")
while(i>10):
print(i)
i=i-1
print("While loop ends")
While loop start
20
19
18
17
16
15
14
13
12
11
While loop ends
while(1) //infinte loop because condition will always true
while(0) // condition is zero so not run