Examveda

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)

A. hello
hello
world

B. world
hello
hello

C. hello
world
world

D. world
hello
world

Answer: Option B


This Question Belongs to Python Program >> Functions In Python

Join The Discussion

Related Questions on Functions in Python