In this body is executed until condition is true. Once the condition becomes false then control comes out the loop.
while condition: Body of while loop
i = 10 while i>5: print i i=i-1
For loop executes the sequence of code according to the specified times and conditions.
for variable in sequence: Body of for loop
i=1 for i in range(1,8): print 2*i
Loop defined within another loop is known as nested loops.
for condition1: for condition2: Body of for loop
This blog will help you get a better understanding of Automate Your Coding with Python!