-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex36.py
More file actions
30 lines (25 loc) · 820 Bytes
/
Copy pathex36.py
File metadata and controls
30 lines (25 loc) · 820 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
from random import randrange
def rock_paper_scissors():
history = []
for i in range(0, 5):
print("Choose rock (0), paper (1) or scissors (2): ")
choice = input("> ")
history.append(choice)
opponents_choice = randrange(3)
if choice == "0" and opponents_choice == 1:
print("You lose.")
elif choice == "0" and opponents_choice == 2:
print("You win.")
elif choice == "1" and opponents_choice == 0:
print("You win.")
elif choice == "1" and opponents_choice == 2:
print("You lose.")
elif choice == "2" and opponents_choice == 0:
print("You lose.")
elif choice == "2" and opponents_choice == 1:
print("You win.")
else:
print("Tie")
for i in history:
print(f"Choice: {i}")
rock_paper_scissors()