Python While Loop

The while loop in python is used to iterate over a block of code as long as the test expression is true.we generally use this loop when we don't know beforehand,the number of times to iterate.the foolowing syntax of while loop in python.

Syntax

							
while condition:
	body of while loop
							
							

Example

							
a = 1;
while a<=5:
	print(a);
	a=a+1;
							
							
Share Share on Facebook Share on Twitter Share on LinkedIn Pin on Pinterest Share on Stumbleupon Share on Tumblr Share on Reddit Share on Diggit

You may also like this!