-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRock_Paper_Scissor.py
More file actions
55 lines (27 loc) · 995 Bytes
/
Copy pathRock_Paper_Scissor.py
File metadata and controls
55 lines (27 loc) · 995 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import random
comp_score = 0
user_score = 0
options = ["rock", "paper", "scissor"]
while True:
user_input = input("Choose Rock/Paper/Scissor or Quit: ").lower()
if user_input == "quit":
break
if user_input not in options:
continue
random_number = random.randint(0,2)
# rock: 0, paper:1, scissor:2
computer_pick = options[random_number]
print("Computer picked", computer_pick)
if user_input == "rock" and computer_pick == "scissor":
print("You won!")
user_score+=1
elif user_input == "scissor" and computer_pick == "paper":
print("You won!")
user_score+=1
elif user_input == "paper" and computer_pick == "rock":
print("You won!")
user_score+=1
else:
print("You lost")
comp_score +=1
print(f"The Scores: your score: {user_score}, computer score: {comp_score}")