The while loop simply tells the computer to do something as long as the condition is met. Its syntax looks like this:
That's it. As long as the condition is met, the action is taken. For example:
while <condition>: <action to be taken>
This loop will execute exactly one time because, on the second pass, 'a' will not be greater than 5. If, however, the last line was omitted, an endless loop would result. If the condition is met and the criterion never changes, the action will be taken repeatedly like this:
a = 6 while a > 5: print a a = a - 1
a = 6 while a > 5: print "This is an endless loop!"