forked from mckrd/py_repo_beginner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
paper_rock_scissors.py
35 lines (32 loc) · 1.05 KB
/
paper_rock_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
import random
print("Papaer, Rock, Scissors!")
# Define choice
choices = ['P', 'R', 'S']
while True:
playerChoice = raw_input("Your turn! [P]aper, [R]ock, [S]cissors, [Q]uit : ")
# convert input to uppercase
playerChoice = playerChoice.upper()
if playerChoice == "Q":
print("Thank you, Have a nice day!")
break
if playerChoice not in(choices):
print("Please choose P, R or S letter!")
continue
computerChoice = random.choice(choices)
print("Your choice is: " +playerChoice)
print("Computer choice is: "+ computerChoice)
if playerChoice == computerChoice:
print("Result: Same choice Draw!")
continue
elif playerChoice == "P" and computerChoice == "R":
print("Result: You Win!")
continue
elif playerChoice == "R" and computerChoice == "S":
print("Result: You Win!")
continue
elif playerChoice == "S" and computerChoice == "P":
print("Result: You Win!")
continue
else:
print("Result: You Lose!")
continue