What will be the output of the following Python code?
def f():
global a
print(a)
a = "hello"
print(a)
a = "world"
f()
print(a)
def f():
global a
print(a)
a = "hello"
print(a)
a = "world"
f()
print(a)
A. hello
hello
world
B. world
hello
hello
C. hello
world
world
D. world
hello
world
Answer: Option B
Join The Discussion