anonymous
  • anonymous
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.
MIT 6.189 A Gentle Introduction to Programming Using Python (OCW)
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
chestercat
  • chestercat
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
eSpeX
  • eSpeX
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?
eSpeX
  • eSpeX
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':
anonymous
  • anonymous
Thanks .... That was it. Being a newbie can be quite frustrating. Thanks again.

Looking for something else?

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

More answers

eSpeX
  • eSpeX
You're welcome.

Looking for something else?

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