Replace for Goto

Carl Banks imbosol at aerojockey.com
Mon Jun 2 01:17:07 CEST 2003


Gerrit Holl wrote:
> 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

No it isn't.  Why should you annoy users by asking them if they want
to play again before they played for the first time?


-- 
CARL BANKS




More information about the Python-list mailing list