-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPaperRockScissorsGame.py
30 lines (28 loc) · 1.29 KB
/
PaperRockScissorsGame.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
# make a rock-paper-scissorgame versus computer
import random
listChoices = ["rock","paper","scissor"]
print("Choose rock, paper or scissor to play or write exit to leave the game")
userChoice = str.lower(input("Rock,Paper or Scissor: "))
while True:
while userChoice not in listChoices:
if userChoice == "exit":
break
print("You have to choose one of the this three options to play: rock, paper or scissor or exit to leave the game")
userChoice = str.lower(input("Rock,Paper or Scissor: "))
else: # if the first statetement is not reached
pcChoice = random.choice(listChoices)
if(userChoice == pcChoice):
print("User Choice --> ",(userChoice))
print("Pc Choice --> ",(pcChoice))
print("It's a tie")
elif ((userChoice == "rock" and pcChoice == "scissor") or (userChoice == "scissor" and pcChoice == "paper") or (userChoice == "paper" and pcChoice == "rock") ):
print("User Choice --> ",(userChoice))
print("Pc Choice --> ",(pcChoice))
print("User Wins congrats!!!!! :)")
else:
print("User Choice --> ",(userChoice))
print("Pc Choice --> ",(pcChoice))
print("Pc Wins Try Again!!!!! :(")
userChoice = None
continue
break