What is the output of the following code ?
def foo(): global x print(x) x = "hi" print(x) x = "welcome" foo() print(x)
Inside the function the value of global variable "x" getting changed in statement x = "hi"So the output will be
x = "hi"
Comment here: