-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
71 lines (56 loc) · 1.93 KB
/
main.py
File metadata and controls
71 lines (56 loc) · 1.93 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import random
print("Welcome toRock, Papper, Sciccors")
user_score = 0
cpu_score = 0
while True:
print()
user_choice = input("Rock, Papper, or Sciccors")
while user_choice != "rock" and user_choice != "papper" and user_choice != "sciccors":
user_choice = input("invalid input, please try again:")
random_num = random.randint(1, 3)
if random_num == 1:
cpu_choice = "rock"
elif random_num == 2:
cpu_choice = "papper"
elif random_num == 3:
cpu_choice = "sciccors"
print()
print("your choice:", user_choice)
print("computers choice:", cpu_choice)
print()
if user_choice == "rock":
if cpu_choice == "rock":
print("its a tie")
elif cpu_choice == "papper":
print("you lost!")
user_score += 1
elif cpu_choice == "sciccors":
print("you win")
user_score += 1
elif user_choice == "papper":
if cpu_choice == "papper":
print ("its a tie!")
elif cpu_choice == "sciccors":
print("you lost!")
cpu_score += 1
elif cpu_choice == "rock":
print("you win!")
cpu_score += 1
elif user_choice == " sciccors":
if cpu_choice == "sciccors":
print("its a tie!")
elif cpu_choice == "rock":
print("you lost!")
cpu_score += 1
elif cpu_choice == "papper":
print("you win!")
user_score += 1
print("You have", user_score, "wins")
print("The computer has", cpu_score, "wins")
print()
repeat = input("play Again? (Y/N").lower()
while repeat != "n" and repeat != "y":
repeat = input("Invalid input, please try again:").lower()
if repeat == "n":
break
print("/n---------------------------------\n")