-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRock_Paper_Scissors.py
More file actions
59 lines (40 loc) · 1.48 KB
/
Rock_Paper_Scissors.py
File metadata and controls
59 lines (40 loc) · 1.48 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
name = input("Enter your name: ")
options = ("ROCK", "PAPER", "SCISSORS")
score_user = 0
score_comp = 0
while score_user < 10 and score_comp < 10:
user_turn = input("Choose Rock, Paper or Scissors: ").upper()
comp_turn = random.choice(options)
print(f"You chose {user_turn}")
print(f"Computer chose {comp_turn}")
if user_turn == comp_turn:
print("Tie")
elif user_turn == "ROCK" and comp_turn == "PAPER":
score_comp += 1
print(f"{name}: {score_user}")
print(f"Computer: {score_comp}")
elif user_turn == "ROCK" and comp_turn == "SCISSORS":
score_user += 1
print(f"{name}: {score_user}")
print(f"Computer: {score_comp}")
elif user_turn == "PAPER" and comp_turn == "ROCK":
score_user += 1
print(f"{name}: {score_user}")
print(f"Computer: {score_comp}")
elif user_turn == "PAPER" and comp_turn == "SCISSORS":
score_comp += 1
print(f"{name}: {score_user}")
print(f"Computer: {score_comp}")
elif user_turn == "SCISSORS" and comp_turn == "ROCK":
score_comp += 1
print(f"{name}: {score_user}")
print(f"Computer: {score_comp}")
elif user_turn == "SCISSORS" and comp_turn == "PAPER":
score_user += 1
print(f"{name}: {score_user}")
print(f"Computer: {score_comp}")
if score_comp > score_user:
print("You have lost the match!")
else:
print(f"Congratulations {name}, you have won the match!")