def speak(message): return message if happy(): speak("I'm happy!") elif sad(): speak("I'm sad.") else: speak("I don't know what I'm feeling.")
The above code is from the exercise:
Cause I’m happy, pharrell!
Note that this code is the sample instructions. What I don’t understand is why you can issue a return statement and then continue with an if statement…
I am saying that I think there is an error here, but want to check if python is the code exception where you can have a return statement and then continue more commands in the function.