[Tutor] NEWBIE- how to make a program continue
alan.gauld@bt.com
alan.gauld@bt.com
Wed, 20 Feb 2002 17:40:19 -0000
> written a small program( with the help of teaching python in
> 24 hours)
Amazing how it works, this book hasn't been mentioned
for weeks and now we get two in one day...
> i want it to countue doing what it does utill i tell it to
> stop. How do I do this?
continue until => a while loop.
( It actually implies a repeat/until loop but Python
hasn't got one of those!)
> year = input ( " Type in a year(0 to stop):" )
while year:
> if julian_leap (year):
> print year, "is leap"
> else:
> print year, "is not a leap year"
year = input ( " Type in a year(0 to stop):" )
Thats it - 2 new lines and one minor modification.
Using zero to stop is fine coz 0 is never a valid year...
Alan g