-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathrock.py
43 lines (35 loc) · 793 Bytes
/
rock.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
import random
def game(comp, you):
if comp == you:
return None
elif comp == 'r':
if you == 's':
return False
elif you == 'p':
return
elif comp == 'p':
if you == 'r':
return False
elif you == 's':
return True
elif comp == 's':
if you == 'p':
return False
elif you == 'r':
return True
print("Comp Turn: Rock(r) Paper(p) Scissors(s?")
randNo = random.randint(1, 3)
if randNo == 1:
comp = 'r'
elif randNo == 2:
comp = 'p'
elif randNo == 3:
comp = 's'
you = input("Your Turn: Rock(r) Paper(p) Scissors(s)?")
a = game(comp, you)
if a == None:
print("The game is a tie!")
elif a:
print("You Win!")
else:
print("You Lose!")