Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. print("Rock, Paper, Scissors")
  2.  
  3. def rps():
  4. userInput = input("Please enter your choice: ")
  5. userInput = userInput.lower()
  6. if userInput != 'rock' and userInput != 'paper' and userInput != 'scissors':
  7. print("Your choice is invalid")
  8. import random
  9. computerChoice = ''
  10. for x in range(1):
  11. num = random.randint(1,4)
  12. if num == 1:
  13. computerChoice = 'rock'
  14. elif num == 2:
  15. computerChoice = 'paper'
  16. elif num == 4:
  17. computerChoice = 'scissors'
  18. if userInput == computerChoice:
  19. print("DRAW!")
  20. elif userInput == 'rock' and computerChoice == 'paper':
  21. print("COMPUTER WINS!")
  22. elif userInput == 'rock' and computerChoice == 'scissors':
  23. print('USER WINS!')
  24. elif userInput == 'paper' and computerChoice == 'rock':
  25. print("USER WINS!")
  26. elif userInput == 'paper' and computerChoice == 'scissors':
  27. print("COMPUTER WINS!")
  28. elif userInput == 'scissors' and computerChoice == 'rock':
  29. print("COMPUTER WINS!")
  30. elif userInput == 'scissors' and computerChoice == 'paper':
  31. print("USER WINS!")
  32. print("Would you like to try again?")
  33. try_again = input("Y/N ")
  34. try_again = try_again.lower()
  35. if try_again == "y":
  36. print("n")
  37. rps()
  38. else:
  39. print("n")
  40. print("Thank you for using my Rock, Paper, Scissors Program")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement