The while loop simply tells the computer to do something as long as the condition is met. Its syntax looks like this:
while <condition>:That's it. As long as the condition is met, the action is taken. For example:
<action to be taken>
a = 6This 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:
while a > 5:
print a
a = a - 1
a = 6
while a > 5:
print "This is an endless loop!"
