Anonymous user
Rock-paper-scissors: Difference between revisions
→{{header|Python}}
Line 3,288:
while True:
human = input('\nchoose your weapon: ')
computer = rules[choice(previous)] # choose the weapon which beats a randomly chosen weapon from "previous"
print('the computer played', computer, end='; ')▼
if human in ('quit', 'exit'): break
elif human in rules:
previous.append(human)
▲ print('the computer played', computer, end='; ')
if rules[computer] == human: # if what beats the computer's choice is the human's choice...
print('yay you win!')
|