Class - 12 CBSE Computer Science Important Output Questions 2025
What will be the output of following program ?
num = 1
def myfunc():
return num
print(num)
print(myfunc())
print(num)
Python
Python Functions
13 Likes
Answer
1
1
1
Working
The code initializes a global variable num with 1. myfunc just returns this global variable. Hence, all the three print statements print 1.
Answered By
5 Likes