title: I am working on a rock, paper, scissors program using functions and it is always returning else cases
body: <p>I am looking for some input on a rock, paper, scissors program that I am making where the statements in the <strong>main()</strong> and <strong>determineWinner</strong> that use <strong>playerChoice</strong> always terminate in the else: case. Each trial will output the player chooses scissors and that the game is tied. I am not sure where I went wrong here as I've printed the input to confirm it is correct before sending to it to the other functions. I cannot figure what pare of the above to function is causing the problem, if anyone could point me in the right direction here I would be grateful.</p>
  
  <p>Here is the code I have so far:</p>
  
  <pre><code>import random
  
  # define main function
  def main():
  
  # initialize playAgain to start game, set stats to 0
      playAgain = 'y'
      numberTied = 0
      numberPlayerWon = 0
      numberComputerWon = 0
      print("Let's play a game of rock, paper, scissors.")
  
      # loop back to play again if user confirms
      while playAgain == 'y' or playAgain == 'Y':
          computerChoice = processComputerChoice()
          playerChoice = processPlayerChoice()
  
          # display computer choice
          if computerChoice == 1:
              print('The computer chooses rock.')
          elif computerChoice == 2:
              print('The computer chooses paper.')
          else:
              print('The computer chooses scissors.')
  
          # display player choice
          if playerChoice == 1:
              print('You choose rock.')
          elif playerChoice == 2:
              print('You choose paper.')
          else:
              print ('You choose scissors.')
  
          # assign who won to result and add total wins/ties to accumulator
          result = determineWinner(playerChoice, computerChoice)
          if result == 'computer':
              numberComputerWon += 1
          elif result == 'player':
              numberPlayerWon += 1
          else:
              numberTied += 1
  
          # ask player if they would like to play again
          print('')
          print
          playAgain = input('Do you want to play again? (Enter y or Y to start another game)')
          print('')
  
      else:
          # print accumulated wins and ties for computer and player
          print('There were', numberTied, 'tie games played.')
          print('The computer won', numberComputerWon, 'game(s).')
          print('The player won', numberPlayerWon, 'game(s).')
          print('')
  
  # define computer choice function       
  def processComputerChoice():
  
      # randomly select an option for the computer to play
      randomNumber = random.randint(1,3)
      print(randomNumber)
      return randomNumber
  
  # define player choice function
  def processPlayerChoice():
      choice = int(input(('What is your choice? Enter 1 for rock, 2 for paper, or 3 for scissors. ')))
      print (choice)
  
      # throw error if player makes invalid choice
      while choice != 1 and choice != 2 and choice != 3:
          print('ERROR: please input a valid choice of 1, 2, or 3')
          choice = int(input('Please enter a correct choice: '))
          return choice
  
  # definition for the function to determine the winner
  def determineWinner(playerChoice, computerChoice):
  
      # determine player choice and compare to computer choice to determine the winner
      if computerChoice == 1:
          if playerChoice == 2:
              print('Paper covers rock. You are victorious!')
              winner = 'player'
          elif playerChoice == 3:
              print('Rock bashes scissors. The computer is victorious!')
              winner = 'computer'
          else:
              print('The game is tied. Try again 1')
              winner = 'tied'
      if computerChoice == 2:
          if playerChoice == 1:
              print('Paper covers rock. The computer is victorious!')
              winner = 'computer'
          elif playerChoice == 3:
              print('Scissors slice paper. You are victorious!')
              winner = 'player'
          else:
              print('The game is tied. Try again 2')
              winner = 'tied'
      if computerChoice == 3:
          if playerChoice == 1:
              print('Rock bashes scissors. You are victorious!')
              winner = 'player'
          elif playerChoice == 2:
              print('Scissors slice paper. The computer is victorious!')
              winner = 'computer'
          else:
              print('The game is tied. Try again 3')
              winner = 'tied'
              return winner
  
  main()
  
  input("Press Enter to continue")
  </code></pre>