A program has a global variable, a function with a local variable, and a function that uses global.
x = 10
def f():
x = 20
return x
def g():
global x
x += 5
return x
print(f(), x, g(), x)
What does the program print?
Log in to join the discussion.
Loading…