Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

3marcus3

  • 2 years ago

Hi all, I am working on the review in "functions" -- unit 4 in codecademy and I seem to be stuck. Any help would be great. Thanks. def shut_down(s): if lower(s) == yes: return "Shutting down..." if lower(s) == no: return "Shutdown aborted!" else: return "Sorry, I didn't understand you." Probably something stupid but I'm a newbie at this.

  • This Question is Open
  1. eSpeX
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 5

    Unless you created/imported a function named "lower()" that takes a string, I'd say that was part of your issue. What is the error you're getting?

  2. eSpeX
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 5

    lower() is a built-in function of the string class, so to use it you would employ the dot notation. s.lower() Since you have a string that you are evaluating you will only be able to compare that to a string. This means that your entries similar to the line if lower(s) == yes: must in fact be changed to if s.lower() == "yes": OR if s.lower() == 'yes':

  3. 3marcus3
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Thanks .... That was it. Being a newbie can be quite frustrating. Thanks again.

  4. eSpeX
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 5

    You're welcome.

  5. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy