Explain, why 3rd print statement can't be displayed on console?

Answer: only first two statements within the function be printed
check here:

the question is key here:

What happens when you call report ?

calling report will execute the function, so only the print statement inside the functions are printed.

1 Like

Thanks alot! I forgot about that. lol :smile:

Firstly, I search this thread because I think that quiz is wrong. What kind of way is only execute the report function. That function use global variables, time and mood. Where do you call the report function in the code before print(“End of report”) or after that. I think there is no way to only use global values but not to call outside print function.

The question is

What happens when you call report?

It is not

What happens when this code is run?

In the latter case, yes, the final print() statement would be executed. But if we only consider what happens when report is run, the answer is that the two print statements inside the function are executed using the two variables defined in the global namespace.