-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrock_paper_sciscorrs.py
47 lines (43 loc) · 1.11 KB
/
rock_paper_sciscorrs.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
"""
Time Complexity: O(n)
Space Complexity: O(1)
"""
game_list = ["Rock", "Paper", "Scissors"]
computer = c = 0
command = p = 0
print("Score:Computer" + str(c) + "Player" + str(p))
while True:
computer_choice = random.choice(game_list)
command = input("Rock , Paper , Scissors or Quit: ")
if command == computer_choice:
print("Tie")
elif command == "Rock":
if computer_choice == "Scissors":
print("Player won!!")
p += 1
else:
print("Computer won!!")
c += 1
elif command == "Paper":
if computer_choice == "Rock":
print("Player won!!")
p += 1
else:
c += 1
elif command == "Scissors":
if computer_choice == "Paper":
print("Player won!!")
p += 1
else:
c += 1
elif command == "Quit":
print("Thank You for playing.")
break
else:
print("Wrong Command!")
print("Player: " + command)
print("Computer: " + computer_choice)
print("")
print("Score:Computer" + str(c) + "Player" + str(p))
print("")