-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgame.py
More file actions
105 lines (62 loc) · 2.31 KB
/
game.py
File metadata and controls
105 lines (62 loc) · 2.31 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
from random import randint
import time
def main():
choice = ["rock", "paper", "scissor"]
point_com = 0
point_play = 0
tim = int(input("Enter how many points : "))
while point_com < tim and point_play < tim:
com = choice[randint(0, 2)]
time.sleep(3)
print("Rock Paper Scissor Shoot!!")
time.sleep(1)
play = input("Choose Rock, Paper, Scissor : ").lower()
if play != choice[0] and play != choice[1] and play != choice[2]:
print("You have entered invaild input")
continue
if com == choice[0]:
if play == choice[2]:
print(f"The computer has put {com}.")
print("So, computer gets one point")
point_com += 1
else:
if play == choice[1]:
print(f"The computer has put {com}.")
print("So, you get a point")
point_play += 1
else:
print(f"The computer has put {com}.")
print("So, no one gets a point")
elif com == choice[1]:
if play == choice[0]:
print(f"The computer has put {com}.")
print("So, computer gets one point")
point_com += 1
else:
if play == choice[2]:
print(f"The computer has put {com}.")
print("So, you get a point")
point_play += 1
else:
print(f"The computer has put {com}.")
print("So, no one gets a point")
else:
if play == choice[1]:
print(f"The computer has put {com}.")
print("So, computer gets one point")
point_com += 1
else:
if play == choice[0]:
print(f"The computer has put {com}.")
print("So, you get a point")
point_play += 1
else:
print(f"The computer has put {com}.")
print("So, no one gets a point")
if point_com == tim:
print("The computer has won.")
print("You have lost")
else:
print("You have won")
print("The computer has lost")
main()