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!

Is this all of your code?
There are missing several function definition here.
You never use return without a function.

Post all of you code and full Traceback.
Or at least code we can run that give this Traceback.
Traceback always give you linenumber where error occur.

Here is a explaintion of UnboundLocalError

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.