[Tutor] While loop counter

2008-07-07 Thread David
Hi, I am trying to get a while loop that will execute 5 time then stop. #!/usr/bin/python # Filename myfirstclass.py # # A Little digital clock from time_class import Time import sys import time mytime = Time() print Can you tell me the time (24h)? hour = input(Give the hour: ) minute =

Re: [Tutor] While loop counter

2008-07-07 Thread John Fouhy
On 08/07/2008, David [EMAIL PROTECTED] wrote: Hi, I am trying to get a while loop that will execute 5 time then stop. Hi David, The standard pattern is like this: i = 0 while i 5: # the stuff you want to do goes here i = i + 1 Note that if you know exactly how many times you will

Re: [Tutor] While loop counter

2008-07-07 Thread Alan Gauld
David [EMAIL PROTECTED] wrote Hi, I am trying to get a while loop that will execute 5 time then stop. Copngratulations, you have succeeded. Unfortunately nothing happens inside your loop. I suspect you actually want to execute some code 5 times? #counter = 0 #while counter 5 : #counter

Re: [Tutor] While loop counter

2008-07-07 Thread David
Thank you John Allen, See the loops section of my tutorial for more about for and while loops. Yes, great tutorial, just getting it to sink in, now thats the problem :) ___ Tutor maillist - Tutor@python.org