-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathRockPaperScissor.py
55 lines (47 loc) · 1.31 KB
/
RockPaperScissor.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
import random
import os
import re
cpoint = 0
upoint = 0
os.system('cls')
for i in range(0,3):
print('\n')
print("Rock, Paper, Scissors!!!")
uss = input("Choose for Rock-R, Paper-P, Scissors-S: ")
if not re.match("[SsRrPp]", uss):
print("Please Select Correct Letters!!")
print("Rock-R, Paper-P, Scissors-S")
continue
choices = ['R','P','S']
opp = random.choice(choices)
print("I chose: "+ opp)
if opp==str.upper(uss):
print("Draw!!")
elif opp==str('P') and str.upper(uss) == ('R'):
print("Computer +1")
cpoint = cpoint + 1
elif opp==str('S') and str.upper(uss) == ('P'):
print("Computer +1")
cpoint = cpoint + 1
elif opp==str('R') and str.upper(uss) == ('S'):
print("Computer +1")
cpoint = cpoint + 1
elif opp==str('R') and str.upper(uss) == ('P'):
print("Player +1")
upoint = upoint + 1
elif opp==str('P') and str.upper(uss) == ('S'):
print("Player +1")
upoint = upoint + 1
elif opp==str('S') and str.upper(uss) == ('R'):
print("Player +1")
upoint = upoint + 1
else:
break
print('\n')
print("Results: ")
if(upoint>cpoint):
print("Player Wins!")
elif(cpoint>upoint):
print("Computer Wins!")
else:
print("Its a draw")