var = 1
def foo():
global v
print(var)
var = 10
print(var)
foo()
print(var)
var = 1
def foo():
global var
print(var)
var = 10
print(var)
foo()
print(var)
Used when a variable is defined through the global
statement but no
assignment to this variable is done.