/
rockpaperscissors.py
66 lines (65 loc) · 1.4 KB
/
rockpaperscissors.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
56
57
58
59
60
61
62
63
64
65
#play a simple rock paper scissors game with cpu by setting a score limit...Those who reches to the score limit first Wins the game...
import random
a=int(input("score limit: "))
count1=0
count2=0
i=0
output=["rock","paper","scissor"]
while (count1<a and count2<a):
print("round",i+1)
i+=1
n=input("your choice: ")
cpu=(random.choice(output))
print("cpu choice: ",cpu)
if n=="rock" and cpu=="rock":
print("its a draw")
print()
print()
if n=="rock" and cpu=="paper":
print("you lost a point")
count2+=3
print()
print()
if n=="rock" and cpu=="scissor":
print("you scored a point")
count1+=1
print()
print()
if n=="paper" and cpu=="rock":
print("you lost a point")
count2+=1
print()
print()
if n=="paper" and cpu=="scissor":
print("you lost a point")
count2+=1
print()
print()
if n=="paper" and cpu=="paper":
print("its a draw")
print()
print()
if n=="scissor" and cpu=="rock":
print("you lost a point")
count2+=1
print()
print()
if n=="scissor" and cpu=="paper":
print("you scored a point")
count1+=1
print()
print()
if n=="scissor" and cpu=="scissor":
print("its a draw")
print()
print()
else:
print("game is over...")
print("your score is",count1)
print(" cpu score is",count2)
if count1==a:
print("you won the game...CONGRATS")
if count1==count2:
print("the game is draw")
if count2==a:
print("sorry you lost the game..better luck next time")