he following code gives the error UnboundLocalError: local variable 'currentpl' referenced before assignment:
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"
How can I fix this? Thanks for any help!