while-loop is used to perform repetition over a block of code as long as the condition is True

Three things are very important for the while-loop

1. Initialization  2. Condition 3. Increment or decrement

while True: –> gives you infinite while-loop.

Flowchart help you to understand the working of while-loop

python program to find the sum of the N natural numbers using while loop

Enter a number: 10 sum of 1 to 10 number is: 55

python program to find the Factorial of the N number using while loop

Enter a number: 5 Factorial of 5 : 120

Using while-loop

one two three four five

Using while-loop

saurabh 19 allinpython.com

a l l i n p y t h o n