What is the output of the following code ?
def foo(): return var + 1 var = 2 print(foo())
var is a global variable. so can be read inside the function (Only read)Adding 1 to it will change the value of var in the global scope.
Comment here: