-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstone_paper_scissor.py
More file actions
35 lines (28 loc) · 917 Bytes
/
stone_paper_scissor.py
File metadata and controls
35 lines (28 loc) · 917 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
import random
user_wins = 0
computer_wins = 0
options = ["stone","paper","scissor"]
while True:
user_pick = input("Enter stone/paper/scissor or q to exit: ").lower()
if user_pick == "q":
break
if user_pick not in options:
print("please enter stone/paper/scissor only")
continue
random_number = random.randint(0,2)
computer_pick = options[random_number]
print("computer pick",computer_pick)
if user_pick == "stone" and computer_pick == "scissor":
print("You Won!")
user_wins +=1
elif user_pick == "paper" and computer_pick == "stone":
print("You Won!")
user_wins +=1
elif user_pick == "scissor" and computer_pick == "paper":
print("You Won!")
user_wins +=1
else:
print("You Lose!")
computer_wins +=1
print("You Won",user_wins,"times")
print("Computer Won",computer_wins,"times")