CBSE Class 12 Computer Science
Question 76 of 103
Working with Functions — Question 9
Back to all questions1
10
10
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. Inside themyfuncfunction, the value 10 is assigned to the global variablenum. Because of the global keyword used earlier, this assignment modifies the value of the global variablenumto 10. The function then returns 10.print(num)— This line prints the value of the global variablenumagain, which is still 1.