-
Notifications
You must be signed in to change notification settings - Fork 0
/
rockpaperscissors.py
44 lines (29 loc) · 1.12 KB
/
rockpaperscissors.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
#ROCK PAPER SCISSORS GAME
import random
def computer():
choice = ['rock', 'paper', 'scissors']
compChoice = random.choice(choice)
print("Computers move: " + compChoice)
return compChoice
def checkWinner(playerChoice, compChoice):
if playerChoice == compChoice:
print("Its a TIE!")
elif playerChoice == 'rock' and compChoice == 'paper':
print("You LOSE")
elif playerChoice == 'rock' and compChoice == 'scissors':
print("You WIN")
elif playerChoice == 'paper' and compChoice == 'scissors':
print("You LOSE")
elif playerChoice == 'paper' and compChoice == 'rock':
print("You WIN")
elif playerChoice == 'scissors' and compChoice == 'rock':
print("You LOSE")
elif playerChoice == 'scissors' and compChoice == 'paper':
print("You WIN")
playerChoice = input("Enter you choice: ").lower()
if playerChoice != "rock" or "paper" or "scissors":
print("Invalid Choice")
else:
print("Your move: " + playerChoice)
compChoice = computer()
checkWinner(playerChoice, compChoice)