examples/advanced/global_variable.py
a = 42
def f():
    global a
    print(a)
    a = 23

print(a)   # 42
f()        # 42
print(a)   # 23

Does not need to be created outside

examples/advanced/global_variable_in_def.py
def f():
    global a
    a = 23

f()
print(a)   # 23