title: error UnboundLocalError: local variable 'currentpl' referenced before assignment:
body: <p>The following code gives the error UnboundLocalError: local variable 'currentpl' referenced before assignment:</p>
  
  <pre><code>def play(num_sq, user_choice):
      drawStrip(num_sq)
      if user_choice == 0:
          currentpl = 1
      elif user_choice == 1:
          currentpl = 2
      while gameover(num_sq):
          if currentpl == 1:
              pick = getPlayerPick(num_sq)
              while not validPlay(pick, num_sq):
                  pick = getPlayerPick(num_sq)
              makePlay(pick, player_col[currentpl])
          if currentpl == 2:
              pick = computerSelection(num_sq)
              makePlay(pick, player_col[currentpl])
          currentpl = togglePlayer(currentpl)
      if currentpl == 2:
          return "User"
      return "Computer"
  </code></pre>
  
  <p>How can I fix this? Thanks for any help!</p>