forked from freyxfi/AllInHacktoberfest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rockpaperscissor.py
65 lines (49 loc) · 1.14 KB
/
rockpaperscissor.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import random
Rock=('''
_______
---' ____)
(_____)
(_____)
(____)
---.__(___)
''')
Paper=('''
_______
---' ____)____
______)
_______)
_______)
---.__________)
''')
Scissors=('''
_______
---' ____)____
______)
__________)
(____)
---.__(___)
''')
# set initial value for user_move
game_ascii = [Rock, Paper, Scissors]
try:
user_move = int(input("What do you choose for rock 0, for paper 1 for scissors 2.:-"))
if (user_move < 0) or (user_move > 2):
print("Please insert a valid number")
print(game_ascii[user_move])
computer_move = random.randint(0,2)
print("computer chose")
print(game_ascii[computer_move])
if user_move == 0 and computer_move == 2:
print("You Win!")
elif computer_move == 0 and user_move == 2:
print("You lose")
elif computer_move > user_move:
print("You Lose")
elif user_move > computer_move:
print("You Win")
elif computer_move == user_move:
print("it's a draw")
except ValueError:
print("Please insert a valid number")
except IndexError:
pass