-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSps.py
More file actions
53 lines (49 loc) · 1.37 KB
/
Sps.py
File metadata and controls
53 lines (49 loc) · 1.37 KB
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
import random
def computer():
comp=random.choice(['scissor','stone','paper'])
return comp
def user():
choose=input("Enter stone, paper or scissor to play:").lower()
return choose
limit=int(input("Enter the final score to be taken to win:"))
c=0
p=0
while True:
choose=user()
com=computer()
print("Computer puts {}".format(com))
if choose==com:
print("Result: Draw")
elif choose == 'scissor':
if com == 'paper':
print("You win")
p+=1
elif com == 'stone':
print("Computer wins")
c+=1
elif choose == 'stone':
if com == 'scissor':
print("You win")
p+=1
elif com == 'paper':
print("Computer wins")
c+=1
elif choose == 'paper':
if com == 'stone':
print("You win")
p+=1
elif com == 'scissor':
print("Computer wins")
c+=1
else:
print("Invalid input Check spelling and try again")
print("Your point {}".format(p))
print("Computer point {}".format(c))
if p==limit:
print("Congratulation you have won")
break
if c==limit:
print("Oops! better luck next time")
break
#limit=int(input("Enter the final score to be taken to win:"))
#gameplay(limit)