Calling function with input | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Calling function with input

Hi all, Can someone please help me out why the following code doesn't work? I expected to be able to enter Yes or No and having the proper reaction as a result... Thanks in advance. def shut_down(s): if s.lower() == "yes": print ("Shutting down...") elif s.lower() == "no": print ("Shutdown aborted!") else: print ("Sorry, I didn't understand you.") s=input("Shutdown? Yes or No") shut_down

11th Nov 2016, 8:46 PM
John Been
John Been - avatar
2 Answers
+ 1
Thanks Adriano for your quick reply!. That is it! Thanks for helping out.
11th Nov 2016, 9:44 PM
John Been
John Been - avatar
0
The last line ought to be shut_down(s) in order to work. You forgot to present the paremeter to the function. I guess that is all.
11th Nov 2016, 9:09 PM
Adriano Armani
Adriano Armani - avatar