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)

1
x is 50
Changed global x to 2
Value of x is 50
2
x is 50 
Changed global x to 2
Value of x is 2
3
x is 50
Changed global x to 50
Value of x is 50
4
None of the mentioned

Sponsored

hivanix.in

Visit

This quiz is brought to you by hivanix.in

🌐 Web App Development

Quick Navigation