I am confused about using *
. The first_example
works, but why doesn't the second_example
work?
The error states:
UnboundLocalError: local variable 'a' referenced before assignment
What can I do to fix this error?
a, b, c, d, e, f, g, h, i = range(1,10)
alphabet = [a, b, c, d, e, f, g, h, i]
def first_example(*alphabet):
j = g + i
print (j)
second_example(*alphabet)
def second_example(*alphabet):
a = a + 1
print (a)
first_example(*alphabet)