You are on page 1of 1

What is difference between While loop and For loop:

While Loop For Loop


While loops are known as indefinite or conditional loops. The for loop is a Python statement i.e. an iteration
They will keep iterating until certain condition is met. The statement which allows a code block to be repeated a
code in a while clause will be executed as long as the while certain number of times.
statement's condition is True.
The while statement has the general form: The syntax of for loop is:
while (condition ): for in range() or sequence():
code block to be executed Code block to be executed

You might also like