?
What will be the output of the following Python code?
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)
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)
Join the Discussion
Login to post a comment or share your explanation.
Login