The following is a part of code RockPaperScissors, I can't figure out how Python, interpret
if answer in ("y", "yes", "Y", "Yes", "Of course"):
return answer
this return as a True.
based on the code below:
def game():
player = move()
computer = random.randint(1, 3)
result(player, computer)
return play_again()
def start():
print "Let's play a game of Rock, Paper, Scissors"
while game():
pass
scores()
def play_again():
answer = raw_input("Would you like to play again ?")
if answer in ("y", "yes", "Y", "Yes", "Of course"):
return answer
else:
print "ok that's enough for today !"
Aucun commentaire:
Enregistrer un commentaire