title: Rock Paper Scissors function help in Python
body: <p>I just started learning Python, and I am trying to write a basic Rock Paper Scissors program for my assignment. The game is intended to go on for 10 rounds, while keeping track the score between the player and the computer. I have two specific problems with it.</p>
  
  <pre><code>import random
  
  def welcome_prompt():
      print ("ROCKER PAPER SCISSORS in PYTHON Assignment")        
      print ("Rules: Rocks beats Scissors, Scissors beats Paper, Paper beats Rock")
  
  def get_player_move():
      print ('Round ' + str(round))        
      print ("Please play one of the following")
      get_player_move = raw_input(" 1) [R]ock, 2) [P]aper, 3) [S]cissors:")
  
      if get_player_move == ("R"):
          print ("You used Rock!") 
          return 1              
  
      elif get_player_move == ("P"):        
          print ("You used Paper!")
          return 2
  
      elif get_player_move == ("S"):
          print ("You used Scissors!")
          return 3
  
      else:
          print "Invalid input, please use capitalized initial (R,P,S)"
          return get_player_move()
  
  def get_computer_move():
          get_computer_move = random.randint(1,3)
  
          if get_computer_move == 1:
              print ("Computer used Rock!")
          return 1
  
      elif get_computer_move == 2:
          print ("Computer used Paper!")
          return 2
  
      elif get_computer_move == 3:
          print ("Computer used Scissors!")
          return 3
  
  
  
  def compare_moves(get_player_move, get_computer_move):
  # Rock = 1
  # Paper = 2
  # Scissors = 3
  
      if (get_player_move ==  1 and get_computer_move == 1) or (get_player_move == 2 and get_computer_move == 2) or (get_player_move == 3 and get_computer_move == 3):
      print ("It's a tie!")
      return 0  
  
      elif (get_player_move == 1 and get_computer_move == 3) or (get_player_move == 2 and get_computer_move == 1) or (get_player_move == 3 and get_computer_move == 2):
      print ("You win the round!")
      return 1
  
      elif (get_player_move == 1 and get_computer_move == 2) or (get_player_move == 2 and get_computer_move == 3) or (get_player_move == 3 and get_computer_move == 1):
      print ("You lose the round!")
      return -1
  
      elif (get_player_move == 4):
      print ("You didn't put in correct input, computer gets a free win")
      return -1
  
  
  # Game Program
  
  player_score = 0
  comp_score = 0
  round = 0
  
  
  welcome_prompt()
  
  ('Round ' + str(round))
  while round&lt; 10:
      round = round + 1
      get_player_move()
      get_computer_move()
      compare_moves(get_player_move, get_computer_move)
  
      if compare_moves == 1:
          player_score = player_score + 1
          print 'Player Score'+ str(player_score)
          print 'Computer Score'+ str(player_score)
      elif compare_moves == -1:
          comp_score = comp_score + 1
          print 'Player Score'+ str(player_score)
          print 'Computer Score'+ str(player_score)        
  
  print "Game Over"
  </code></pre>
  
  <p>Firstly, I can't get the compare_move function to recall the returned values  from both get_player_move and get_computer_move. The game can run without any error, but it just skips the comparison/ score component completely. I am still a bit iffy with the basics, so not exactly sure what is  missing.</p>
  
  <p>Secondly, in the get_player_move function, when I enter an invalid input (example: blah) to test the raw_input, it gives an error. </p>
  
  <pre><code>Traceback (most recent call last):
    File "C:\Python27\Rock Paper Scissors.py", line 85, in &lt;module&gt;
      get_player_move()
    File "C:\Python27\Rock Paper Scissors.py", line 32, in get_player_move
      return get_player_move()
  TypeError: 'str' object is not callable
  </code></pre>
  
  <p>So how do you make a function to asks for the correct raw_input again after entering invalid input, without interrupting the while loop?</p>
  
  <p>Explanation is greatly appreciated, thank you </p>