1
2
3
4
5
6
7
8
9
10
11
12
13
14
def spam():
global eggs # this is the global
eggs = 'spam'
def bacon():
eggs = 'bacon' # this is a local
def ham():
print(eggs) # this is the global
eggs = 42 # this is the global
spam()
print(eggs)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX