forked from accakks/Simple-Programs-in-Python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRockPaperScissorInCLI.py
More file actions
51 lines (29 loc) · 867 Bytes
/
RockPaperScissorInCLI.py
File metadata and controls
51 lines (29 loc) · 867 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
40
41
42
43
44
45
46
47
48
49
import random
options = ['rock', 'paper', 'scissor']
again='Y'
while(again.upper()=='Y'):
user=0
comp=0
while(user<3 and comp<3):
print("Enter a response")
x = random.choice(options)
choice = input()
print("You chose " + choice.upper())
print("The computer chose " + x.upper())
if(x.upper()==choice.upper()):
print("Please Try again")
elif(x.upper()=="ROCK" and choice.upper()=="SCISSOR"):
comp+=1
elif(x.upper()=="ROCK" and choice.upper()=="PAPER"):
user+=1
elif(x.upper()=="PAPER" and choice.upper()=="ROCK"):
comp+=1
elif(x.upper()=="PAPER" and choice.upper()=="SCISSOR"):
user+=1
elif(x.upper()=="SCISSOR" and choice.upper()=="ROCK"):
user+=1
elif(x.upper()=="SCISSOR" and choice.upper()=="PAPER"):
comp+=1
print("user: ",user)
print("computer: ",comp)
again = input("Play again?(Y/N)")