What will be the output of the following Python code?
x = 50
def func(x):
print('x is', x)
x = 2
print('Changed local x to', x)
func(x)
print('x is now', x)
x = 50
def func(x):
print('x is', x)
x = 2
print('Changed local x to', x)
func(x)
print('x is now', x)A. x is 50
Changed local x to 2
x is now 50
B. x is 50
Changed local x to 2
x is now 2
C. x is 50
Changed local x to 2
x is now 100
D. None of the mentioned
Answer: Option A

Join The Discussion