What is a global statement? And how is it used? I have read Python\'s official definition; however, it doesn\'t make a lot of sense to me.
a = 1 def f(): a = 2 # doesn't affect global a, this new definition hides it in local scope a = 1 def f(): global a a = 2 # affects global a