Skip to content Skip to sidebar Skip to footer

Another Local Variable Referenced Before Assignment - Python

I'll start by saying: I know this is a question that gets asked a lot. I've read the other answers, and have ruled out: I'm not using += for the assignment; I've tried explicitly

Solution 1:

You misspelled "conceded":

condeded_away = 0
   ^

Also, you may want to use a different data structure for final_stats, like a dictionary:

teams = {
    'team1': [...],
    'team2': [...],
    ...
}

You can then look up the stats for a team much more quickly:

stats = teams['team2']

Post a Comment for "Another Local Variable Referenced Before Assignment - Python"