Python Functions Quiz - Is the answer... wrong?


#1

I’m currently working through the Python Function section of the Data Science path.

In the Python Functions quiz (https://www.codecademy.com/paths/data-science/tracks/dspath-functions-and-logic/modules/dspath-python-functions/quizzes/functions-quiz) we’re asked what happens when the following code is run:

time = "3pm"
mood = "good"

def report():
  print("The current time is " + time)
  print("The mood is " + mood)

print("End of report")

The answer is given as:
Two Strings are printed: "The current time is 3pm" and "The mood is good"

However, I can’t see where the function report() is called in order to give this answer. As far as I can see, only “End of report” would be printed to the console here. Can anyone shed some light on this query for me?

Thanks :slight_smile:


#2

Hi @netrockstar62924,

The question they ask is …

What happens when you call report ?

It is true that if you do call the function, two strings are printed as a direct result of that call. However, the intended meaning of the question did, admittedly, seem a bit unclear until I saw their answer.


#3

Of course… Instinctively I tried to look for the result of running the code.

Thanks for your help.