Learn
Functions
Review: Functions

Okay! Let’s review functions.

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.")

Again, the example code above is just there for your reference!

Instructions

1.

First, def a function, shut_down, that takes one argument s. Don’t forget the parentheses or the colon!

Then, if the shut_down function receives an s equal to "yes", it should return "Shutting down"

Alternatively, elif s is equal to "no", then the function should return "Shutdown aborted".

Finally, if shut_down gets anything other than those inputs, the function should return "Sorry"

Folder Icon

Take this course for free

Already have an account?