First question here, thanks for reading.
In Python you cannot change global variables within a function without first using global, but you can do that with lists. What is exactly going on? Lists are assigned to a variable as well, right?
Examples:
Global variable
a = 1
def add_1():
a += 1
add_1()
--->"UnboundLocalError: local variable 'a' referenced before assignment"
Global list
b = ["a", "b"]
def appnd_1():
b.append("c")
appnd_1()
print(b)
--->"['a', 'b', 'c']"
Thanks!