-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
70 lines (47 loc) · 1.23 KB
/
main.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
60
61
62
63
64
65
66
67
68
69
70
import random
def main():
p=1
while p ==1:
print("Rock, Paper, Scissors")
x=input("(rock), (paper) or (scissors): ")
cpu= random.randint(1,3)
Rock= 1
Paper=2
Scissors=3
if x == "rock" and cpu == Rock:
print("cpu displays rock")
print("tie")
elif x== "rock" and cpu == Paper:
print("cpu displays paper")
print("cpu wins")
elif x== "rock" and cpu == Scissors:
print("Cpu displays scissors")
print("you win")
elif x=="paper" and cpu == Rock:
print("cpu displays rock")
print("you win")
elif x=="paper" and cpu== Paper:
print("cpu displays rock")
print("tie")
elif x=="paper" and cpu== Scissors:
print("cpu displays scissors")
print("cpu wins")
elif x=="scissors" and cpu == Rock:
print("cpu displays rock")
print("cpu wins")
elif x=="scissors" and cpu==Paper:
print("cpu displays paper")
print("you win")
elif x=="scissors" and cpu==Scissors:
print("cpu displays scissors")
print("tie")
elif x=="quit":
print("game over")
else:
print("error")
playagain=input("playagain(y/n)")
if playagain=="y":
p=1
else:
p=0
main()