Feb-08-2020, 01:52 AM
(This post was last modified: Feb-08-2020, 01:52 AM by new_to_python.)
Hello, I came across the following code:
a = None def bind_a_variable(): global a a = [] bind_a_variable()It is stated that assigning variables outside of the function's scope is possible but those variables must be declared as global via the global keyboard. I am a C programmer. In C, we have to declare a variable first before using it. I would declare global a before
a = None. However, in the example, a is declared inside a function and after the
a = Noneassignment. Could anybody please clarify?