What will be the output of following program ?
num = 1 def myfunc(): return num print(num) print(myfunc()) print(num)
1 1 1
The code initializes a global variable num with 1. myfunc just returns this global variable. Hence, all the three print statements print 1.
num
myfunc
print