[Tutor] Repeating an action

Alan Gilfoy agilfoy at frontiernet.net
Sat May 12 16:31:04 CEST 2007

How do you 'tell' Python to repeat a certain action X amount of times,  
and then stop.

I could use a 'counter' (see below), but that seems kind of clunky.

counter = 0
example = True
while example:

     print "Do something"
     counter += 1

     if counter == 100:
     example = False

More information about the Tutor mailing list