Ask coding questions

← Back to all posts
local variable 'x' defined in enclosing scope on line 3 referenced before assignment
IntelDS (2)

For some reason, line 15 throws up an error when I try to do x+=1 even though I have already given x a value on line 3. I tried looking this up and I only found stuff about the LEGB rules and nothing about how to fix it. Sorry if this is really easy to fix and I wasted your time.