Advertisement
Guest User

Untitled

a guest
Oct 4th, 2015
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. def winner(user_action, computer_choice):
  2.  
  3. if user_action == rock and computer_choice == 1:
  4. print("It's a tie!")
  5. elif user_action == '1' and computer_choice == 2:
  6. print('The computer wins')
  7. elif user_action == '1' and computer_choice == 3:
  8. print('You win!')
  9.  
  10. elif user_action == '2' and computer_choice == 1:
  11. print('You win!')
  12. elif user_action == '2' and computer_choice == 2:
  13. print("It's a tie!")
  14. elif user_action == '2' and computer_choice == 3:
  15. print('You lose!')
  16.  
  17. elif user_action == '3' and computer_choice == 1:
  18. print('You lose!')
  19. elif user_action == '3' and computer_choice == 2:
  20. print("You win!")
  21. elif user_action == '3' and computer_choice == 3:
  22. print('You Tied!')
  23.  
  24. #return winner
  25.  
  26.  
  27. def menu():
  28.  
  29. print('\n MENU')
  30. print('(1) Rock')
  31. print('(2) Paper')
  32. print('(3) Scissors')
  33. print('(4) Quit')
  34. print()
  35.  
  36. user_action = input('Chose your action by pressing 1, 2, 3 or 4. ')
  37.  
  38. while user_action != '1' and user_action != '2' and user_action != '3' \
  39. and user_action != '4':
  40. print('\nError: Invalid selection ')
  41. user_action = input('\nPlease enter a number between 1 and 4 ')
  42.  
  43. return user_action
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement