Good evening.
I can not understand the global and local variables. I wanted to make it as simple as this:
counter = 1 def incr(): counter += 1 counterString = counter.__str__() return counterString print incr() + ' : ' + someString It gives an error that the variable is local and has not yet been declared ...
UnboundLocalError: local variable 'counter' referenced before assignment
How to be in this case?
PS print incr() + ' : ' + someString is executed in a loop