While loop

While loops do something for so long as a predefined condition is true.

For example, in the snippet below, we have an integer, count, which has been assigned the value of 0

The while loop block then says for so long as the value of count is less than 9, print the value of count. Each iteration of the loop increases the value of count by 1. 

The condition that the value of count is less than 9 remains true for 9 iterations of the loop. At the tenth pass, the value of count becomes 9 and so the condition that count must be less than 9 becomes false, causing the loop to complete.

count = 0
while (count < 9):
    print 'The count is at:', count
    count = count + 1

print "Romeo done."