Rock-paper-scissors: Difference between revisions

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) # add human's choice to "previous"
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!')