-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathp1_RPS_GAME.py
More file actions
31 lines (26 loc) · 914 Bytes
/
Copy pathp1_RPS_GAME.py
File metadata and controls
31 lines (26 loc) · 914 Bytes
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
import random
print("Welcome to Game")
print("Can't interst this game pls 'exit'\n")
lst = ["rock","paper","scissors"]
round = 0
ch_round = str_round = 0
while True:
ch = random.choice(lst)
str = input("User choose:").lower()
if str=="exit":
break
if str == "rock" or str == "paper" or str == "scissors" :
print("Computer choose :",ch)
else:
print("Invaild string try again")
if (ch=="rock" and str=="paper") or (ch=="scissors" and str=="paper") or (ch=="rock" and str=="scissors"):
print("Computer win")
ch_round+=1
elif (ch=="paper" and str=="rock") or (ch=="paper" and str=="scissors") or (ch=="scissors" and str=="rock"):
print("User win")
str_round+=1
else:
print("Match Draw\n")
round+=1
print(f"computer score {ch_round}\nUser score {str_round}")
print(f"Round {round} complete\n")