Untitled
unknown
python
2 years ago
944 B
5
Indexable
if __name__ == '__main__':
print("Please pick one:\n\trock\n\tscissors\n\tpaper")
while True:
game_dict = {'rock': 1, 'scissors': 2, 'paper': 3}
player_a = input("Player a: ")
player_b = input("Player b: ")
a = game_dict[player_a]
b = game_dict[player_b]
different = a - b
if different in [-1, 2]:
print("Player a wins!")
if input("Do you want to play again? (yes or no)\n").lower() == "yes":
continue
else:
print('Game over')
break
elif different in [-2, 1]:
print("Player b wins!")
if input("Do you want to play again? (yes or no)\n").lower() == "yes":
continue
else:
print('Game over')
break
else:
print("Draw. Please continue.")
continue
Editor is loading...
Leave a Comment