Python scope: “UnboundLocalError: local variable ‘c’ referenced before assignment”
I am trying to figure out this: c = 1 def f(n): print c + n def g(n): c = c + n f(1) # => 2 g(1) # => UnboundLocalError: local variable 'c' referenced before assignment Thanks! Answers: Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may … Read more