>>> def f():
... global x
... x= 42
...
>>> f()
>>> print(x)
42
>>> y = 9
>>> global y
>>> def g():
... y = 43
>>> g()
>>> print(y)
9
>>>