While_loop_Notes
While_loop_Notes
Python While Loop: is used to execute a block of statements repeatedly until a given condition
is satisfied. When the condition becomes false, the line immediately after the loop in the
program is executed.
while expression:
statement(s)
Flowchart of Python While Loop
Example1: In this example, the condition for while will be True as long as the counter variable
(count) is less than 3.
count = 0
while (count < 3):
count = count + 1
print("Hello Geek")
Output
Hello Geek
Hello Geek
Hello Geek
num=2
i=1
while i <=10:
print(num,'x',i,'=',num*i)
i=i+1