-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrps.py
More file actions
31 lines (22 loc) 路 647 Bytes
/
Copy pathrps.py
File metadata and controls
31 lines (22 loc) 路 647 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
31
import random
import sys
playerChoice = input("Enter...\n1. Rock\n2. Paper\n3. Scissor\n")
player = int(playerChoice)
if player < 1 or player > 3:
print("You must choose 1, 2 or 3.")
sys.exit()
computerChoice = random.choice("123")
computer = int(computerChoice)
print("You chose " + playerChoice + ".")
print("python chose " + computerChoice + ".")
print("")
if player == 1 and computer == 3:
print("馃帀 You win!")
elif player == 2 and computer == 1:
print("馃帀 You win!")
elif player == 3 and computer == 2:
print("馃帀 You win!")
elif player == computer:
print("馃槃 Tie game!")
else:
print("python win!")