Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def winner(user_action, computer_choice):
- if user_action == rock and computer_choice == 1:
- print("It's a tie!")
- elif user_action == '1' and computer_choice == 2:
- print('The computer wins')
- elif user_action == '1' and computer_choice == 3:
- print('You win!')
- elif user_action == '2' and computer_choice == 1:
- print('You win!')
- elif user_action == '2' and computer_choice == 2:
- print("It's a tie!")
- elif user_action == '2' and computer_choice == 3:
- print('You lose!')
- elif user_action == '3' and computer_choice == 1:
- print('You lose!')
- elif user_action == '3' and computer_choice == 2:
- print("You win!")
- elif user_action == '3' and computer_choice == 3:
- print('You Tied!')
- #return winner
- def menu():
- print('\n MENU')
- print('(1) Rock')
- print('(2) Paper')
- print('(3) Scissors')
- print('(4) Quit')
- print()
- user_action = input('Chose your action by pressing 1, 2, 3 or 4. ')
- while user_action != '1' and user_action != '2' and user_action != '3' \
- and user_action != '4':
- print('\nError: Invalid selection ')
- user_action = input('\nPlease enter a number between 1 and 4 ')
- return user_action
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement