-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRock-Paper-Scissors
More file actions
39 lines (26 loc) · 801 Bytes
/
Rock-Paper-Scissors
File metadata and controls
39 lines (26 loc) · 801 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
34
35
36
37
38
39
import random
while(True):
print("WELCOME TO THE GAME OF ROCK, PAPAER AND SCISSORS")
print("\n1.Rock\n2.Paper\n3.Scissors")
x=int( input("Enter your choice"))
a= [1,2,3]
# 1 - Rock, 2- Paper, 3- Scissors
x1= random.choice(a)
if(x1==1):
print("\nComputer chooses Rock")
elif(x1==2):
print("\nComputer chooses Paper")
else:
print("\nComputer choose Scissors")
if( x==x1 ):
print("No decisive winner")
elif((x1==1 and x==3) or (x1==2 and x==1) or (x1==3 and x==2)):
print("\n\n Winner : Computer")
else:
print("\n\n YAY! You Win!")
ch=int(input("press 1 for another game or 0 to exit"))
if(ch==0):
break
else:
print('\n\n')
del x1