/
exercise2.py
32 lines (29 loc) · 870 Bytes
/
exercise2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#Create a simple rock,paper,scissors game
print('''Let play a game! Please pick one: \n
Rock
Paper
Scissors \n''')
while True:
game_dict = {'rock': 1, 'scissors': 2, 'paper': 3}
player_a = str(input("Player A: "))
player_b = str(input("Player B: "))
a = game_dict.get(player_a)
b = game_dict.get(player_b)
dif = a - b
if dif in [-1, 2]:
print('\nPlayer A Wins!')
if str(input('\nDo you want to play another game, yes or no? ')) == 'yes':
continue
else:
print('\nGame Over')
break
elif dif in [-2, 1]:
print('\nPlayer B Wins!')
if str(input('\nDo you want to play another game, yes or no? ')) == 'yes':
continue
else:
print('\nGame Over')
break
else:
print('\n Draw...Please continue')
print('')