What am I doing wrong here?

counter = 0

def increment():
  counter += 1

increment()

The above code throws an UnboundLocalError.

8 Answers
8

Leave a Reply

Your email address will not be published. Required fields are marked *