0
list and global variable: why there is no "global a" in test().
a = [10,20] def test(m): m.append(30) test(a) print(a) a is a global variable and it's changed by append in test(), but why there is no "global a" statement.
2 ответов
0
When you give an object like a list as argument in a function, it doesn't copy the object but modify it.
0
That's hard to understand if you never learn c or c++ language.