Vidyalelo
Python · Q56

Functions in Python

Programming · Python · question 56

Q56

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
Answer
C.
hello
world
world
D.
world
hello
world

Answer: Option B

Solution

Answer: Option B
No explanation is given for this question Let's Discuss on Board