Guest User

Untitled

a guest
Oct 17th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. import random;
  2. player = input("Enter your choice (rock/paper/scissors): ");
  3. player = player.lower();
  4. while (player != "rock" and player != "paper" and player != "scissors"):
  5. print(player);
  6. player = input("That choice is not valid. Enter your choice (rock/paper/scissors): ");
  7. player = player.lower();
  8. computerInt = random.randint(0,2);
  9. if (computerInt == 0):
  10. computer = "rock";
  11. elif (computerInt == 1):
  12. computer = "paper";
  13. elif (computerInt == 2):
  14. computer = "scissors";
  15. else:
  16. computer = "Huh? Error...";
  17. if (player == computer):
  18. elif (player == "rock"):
  19. if (computer == "paper"):
  20. print("Computer wins!");
  21. else:
  22. print("You win!");
  23. elif (player == "paper"):
  24. if (computer == "rock"):
  25. print("You win!");
  26. else:
  27. print("Computer wins!")
  28. elif (player == "scissors"):
  29. if (computer == "rock"):
  30. print("Computer wins!");
  31. else:
  32. print("You win!");
  33. print("Your choice: " + player + "\nComputer choice: " + computer + "\nThank you for playing!");
  34. input("Enter any key to exit.");
Add Comment
Please, Sign In to add comment