Vidyalelo
Python · Q77

Functions in Python

Programming · Python · question 77

Q77

What will be the output of the following Python code? x = 50 def func(): global x print('x is', x) x = 2 print('Changed global x to', x) func() print('Value of x is', x)

A.
x is 50
Changed global x to 2
Value of x is 50
B.
x is 50
Changed global x to 2
Value of x is 2
Answer
C.
x is 50
Changed global x to 50
Value of x is 50
D.
None of the mentioned

Answer: Option B

Solution

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