-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1.py
49 lines (42 loc) · 1.49 KB
/
1.py
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
import random
computer_score = 0
user_score = 0
items1 = ("Rock", "Paper", "Scissor")
items2 = ("Rock", "Paper", "Scissor", "Exit")
while True:
computer_choice = random.choice(items1)
print("0-Rock")
print("1-Paper")
print("2-Scissor")
print("3-Exit")
user_choice_index = int(input())
user_choice = items2[user_choice_index]
print(computer_choice)
if computer_choice == "Rock" and user_choice == "Scissor":
print("Computer wins")
computer_score += 1
elif computer_choice == "Rock" and user_choice == "Paper":
print("User wins")
user_score += 1
elif computer_choice == "Rock" and user_choice == "Rock":
print("Tie!")
elif computer_choice == "Scissor" and user_choice == "Paper":
print("Computer wins")
computer_score += 1
elif computer_choice == "Scissor" and user_choice == "Rock":
print("User wins")
user_score += 1
elif computer_choice == "Scissor" and user_choice == "Scissor":
print("Tie!")
elif computer_choice == "Paper" and user_choice == "Rock":
print("Computer wins")
computer_score += 1
elif computer_choice == "Paper" and user_choice == "Scissor":
print("User wins")
user_score += 1
elif computer_choice == "Paper" and user_choice == "Paper":
print("Tie!")
else:
print("user_score:", user_score)
print("computer_score:", computer_score)
break