Advertisement
Guest User

Untitled

a guest
Apr 3rd, 2020
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.00 KB | None | 0 0
  1. import random
  2.  
  3. playerChoice = int(input("1 for Rock, 2 for Paper and 3 for Scissors "))
  4. print(playerChoice) # 'Debug'
  5. isWinner = True
  6. while not isWinner:
  7.  
  8.     compChoice = random.randint(1, 3)
  9.     # Conditions for player
  10.     if playerChoice == 1 and compChoice == 2:
  11.         print("Paper beats rock. You Lose!")
  12.         isWinner = False
  13.     elif playerChoice == 1 and compChoice == 3:
  14.         print("Rock beats Scissors. You Win!")
  15.         isWinner = True
  16.     elif playerChoice == 2 and compChoice == 1:
  17.         print("Paper beats rock. You win!")
  18.         isWinner = True
  19.     elif playerChoice == 2 and compChoice == 3:
  20.         print("Rock beats Scissors. You Lose!")
  21.         isWinner = False
  22.     elif playerChoice == 3 and compChoice == 1:
  23.         print("You lose!")
  24.         isWinner = False
  25.     elif playerChoice == 3 and compChoice == 2:
  26.         print("You win!")
  27.         isWinner = True
  28.     else:
  29.         print("Invalid Number or you Tied")
  30.         isWinner = False
  31. # print("Game over")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement