Got Homework?
Connect with other students for help. It's a free community.
Here's the question you clicked on:
 0 viewing
3marcus3
Group Title
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.
 one year ago
 one year ago
3marcus3 Group Title
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.
 one year ago
 one year ago

This Question is Open

eSpeX Group TitleBest ResponseYou've already chosen the best response.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?
 one year ago

eSpeX Group TitleBest ResponseYou've already chosen the best response.5
lower() is a builtin 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':
 one year ago

3marcus3 Group TitleBest ResponseYou've already chosen the best response.0
Thanks .... That was it. Being a newbie can be quite frustrating. Thanks again.
 one year ago

eSpeX Group TitleBest ResponseYou've already chosen the best response.5
You're welcome.
 one year ago
See more questions >>>
Your question is ready. Sign up for free to start getting answers.
spraguer
(Moderator)
5
→ View Detailed Profile
is replying to Can someone tell me what button the professor is hitting...
23
 Teamwork 19 Teammate
 Problem Solving 19 Hero
 Engagement 19 Mad Hatter
 You have blocked this person.
 ✔ You're a fan Checking fan status...
Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.