Replace for Goto

Gerrit Holl gerrit at
Sun Jun 1 23:14:10 CEST 2003

Gerhard Häring schreef op donderdag 29 mei om 03:04:37 +0000:
> Use a never-ending while loop, then use an "if" and a "break". Like this:
> while 1:
>     # do stuff
>     answer = raw_input("Want to play again? (y/n)").upper()
>     if answer == 'N':
>         break

Or, even better:

while raw_input("Want to play again? (y/n)").upper()[0] != 'N':
    # do stuff


100. ... interest for the money, as much as he has received, he shall
give a note therefor, and on the day, when they settle, pay to the
        -- Hammurabi, Code of Law
Asperger Syndroom - een persoonlijke benadering:
Het zijn tijden om je zelf met politiek te bemoeien:

More information about the Python-list mailing list