Lesson 17: Review Functions


Cannot figure out where I am messing this up. Hope some can help and even elaborate on best practices for functions in python.


Message state:
Oops, try again. Your function failed on the message yes. It returned 'yes' when it should have returned 'Shutting down'

output need to be as intended

def shut_down(s):
    return s
    if s == yes:
      shut_down("Shutting down")
    elif s == no:
        shut_down("Shutdown aborted")
        return "Sorry"


When a function reaches to return statement it does not execute code under it.
It just returns the value and halt it, try removing it?


shut_down("Shutting down")

You have to return "Shutting down"

for example..

return "Shutting down"

Make same changes in second elif part,


Thank yo greentreemee , that worked. See below:

def shut_down(s):

if s == "yes":
   return"Shutting down"
elif s == "no":
    return "Shutdown aborted"
   return "Sorry"


What an irony of fate. Hours ago I was stuck in this lesson too haha: D
Were you able to solve your problem? ^^



this is the 2nd language that im learning after C++ being the first, which was way tougher. I'd say i know the basics of programming and yet i got stuck on this review too (first time getting stuck) and the reason why and it also applies to the person who made this post, is that the example that theyd provided us with. i was following the same pattern as its shown in the example and got it wrong. the code was still simple and obvious but none of us here are trying to apply "common sense" because its a new language and we dont know anything about it yet. I think its best if the web owners change the example to something more relatable as I am not the first one who was mislead by it.


They are doing it.
Soon the current course of HTML & CSS and Python, will be extinct. They will update the course soon. An example is that there is already a new course of HTML & CSS, called HTML & CSS Part 1.

I've also been stuck in certain lessons and even in this and for the same reason. The instruction given in certain lessons in this language is very bad and the same thing is revealed in terms of the tips.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.