-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRock Paper Scissors.py
47 lines (43 loc) · 1.14 KB
/
Rock Paper Scissors.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
import random
# Setup
game_list = ["Rock", "Paper", "Scissors"]
computer = c = 0
command = p = 0
print(f"Scores: Computer = {c} & Player = {p}")
# Main Loop
while True:
computer_choice = random.choice(game_list)
command = input("Rock, Paper, Scissors or Quit: ")
if command == computer_choice:
print("\nTie\n")
elif command == "Rock":
if computer_choice == "Scissors":
print("\nPlayer Won!\n")
p += 1
else:
print("\nComputer Won!")
c += 1
elif command == "Paper":
if computer_choice == "Rock":
print("\nPlayer Won!")
p += 1
else:
print("\nComputer Won!")
c += 1
elif command == "Scissors":
if computer_choice == "Paper":
print("\nPlayer Won!")
p += 1
else:
print("\nComputer Won!")
c += 1
elif command == "Quit":
break
else:
print("Invalid Input.")
# Display
print(f"Player: {command}")
print(f"Computer: {computer_choice}")
print("")
print(f"Scores: Computer = {c} & Player = {p}")
print("")