-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrock_paper_scissor.py
More file actions
33 lines (30 loc) · 907 Bytes
/
rock_paper_scissor.py
File metadata and controls
33 lines (30 loc) · 907 Bytes
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
import random
print('\t\t\t\tRock Paper Scissor\n')
print("1.Rock\n2.Paper\n3.Scissor\n\n")
USER = 0
CPU = 0
TIE = 0
i =1
while i<=5:
choice = int(input('Enter your choice : '))
if choice>=1 and choice<=3:
computer = random.randint(1,3)
if ((choice==1 and computer==3) or (choice==2 and computer==1) or (choice==3 and computer==2)):
print("Congrats you win\n")
USER+=1
elif ((computer==1 and choice==3)or(computer==2 and choice==1)or(computer==3 and choice==2)):
print("Computer win\n")
CPU+=1
else:
print("Tie!!!\n")
TIE+=1
i+=1
else:
print("Enter a valid choice")
print(f"Total winnig\nYou win :{USER}\nComputer win :{CPU}\nTie Matches :{TIE}\n")
if USER>CPU:
print("You win the series")
elif CPU>USER:
print("Computer wins the series")
else :
print("Series Tied!!!")