-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRockPaperScissorGame.py
More file actions
48 lines (48 loc) · 1.76 KB
/
RockPaperScissorGame.py
File metadata and controls
48 lines (48 loc) · 1.76 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
import random
x = input("This is a rock paper scissors game, for rock type 'r', for paper type 'p' and for scissor type 's'\n")
z = 0
while True:
while True:
AI = ["r", "p", "s"]
y = random.choice(AI)
if x == "r" and y == "s":
print("you won, the bot chose scissor")
z = z + 1
x = input("please choose from r, p and s again\n")
elif x == "s" and y == "p":
print("you won, the bot chose paper")
z =z +1
x = input("please choose from r, p and s again\n")
elif x == "p" and y == "r":
print("you won, the bot chose rock")
z = z + 1
x = input("please choose from r, p and s again\n")
elif x == "r" and y == "r":
print("it is a tie")
x = input("please choose from r, p and s again\n")
elif x == "s" and y == "s":
print("it is a tie")
x = input("please choose from r, p and s again\n")
elif x == "p" and y == "p":
print("it is a tie")
x = input("please choose from r, p and s again\n")
elif x == "r" and y == "p":
print("you lost, the bot chose paper")
break
elif x == "p" and y == "s":
print("you lost, the bot chose scissor")
break
elif x == "s" and y == "r":
print("you lost, the bot chose rock")
break
else:
print("please choose from r, p or s")
x = input("please choose from r, p and s again\n")
a = f"you won {z} times"
print(a)
aga = input("Do you want to try again (y/n)\n")
if aga == "y":
print("restarting the game")
x = input("please choose between r, p and s \n")
else:
break