[Tutor] Craps, eternal loop (Joseph Q.)
Smith, Jeff
jsmith at medplus.com
Thu Apr 14 17:28:01 CEST 2005
-----Original Message-----
From: tutor-bounces at python.org [mailto:tutor-bounces at python.org] On
Behalf Of Joseph Quigley
Sent: Wednesday, April 13, 2005 6:57 PM
To: tutor at python.org
Subject: [Tutor] Craps, eternal loop (Joseph Q.)
>I get an eternal loop on this game that I don't want and can't figure
out
>how to fix.
>BTW any of you know the rules to craps? I don't remember them all so
this
>game may be different than the casino version.
This is your problem:
if play_again == ("Y") or ("y") or ("Yes") or ("yes") or ("YES"):
Which is interpreted as (note the extra parens):
if (play_again == ("Y")) or ("y") or ("Yes") or ("yes") or ("YES"):
What you want is:
if play_again in ("Y","y","Yes","yes","YES"):
Or better yet:
if play_again.upper() in ('Y','YES'):
Jeff
More information about the Tutor
mailing list