CBSE Class 12 Computer Science
Question 75 of 103
Working with Functions — Question 8
Back to all questions1
10
1
num = 1— This line assigns the value 1 to the global variablenum.def myfunc()— This line defines a function namedmyfunc.print(num)— This line prints the value of the global variablenum, which is 1.print(myfunc())— This line calls themyfuncfunction. Insidemyfuncfunction,num = 10defines a local variablenumand assigns it the value of10which is then returned by the function. It is important to note that the value of global variablenumis still 1 asnumofmyfuncis local to it and different from global variablenum.print(num)— This line prints the value of the global variablenum, which is still 1.