Shut down functions


#1

getting yes instead of shut down function... why am i doing wrong?


#2

Ok so first off you don't need to return s after defining it. I don't really see what that does and it returns an error so get rid of it. Also, you don't need to include shut_down again in your if and elif you can just say if s == "yes" because what is determing what happens is not shut_down(s) that has been defined and everything is under it. But what is the real difference is whether or not it equals yes or no so get rid of shut_down(s) in those cases and that should work great.


#3

got it! i guess i'm missing the concept? how does the system know i wanted to pick s as in YES and return shutting down.
i didn't write a specifc code to have s to be yes and not no? does it just default to the 1st line of the if statement ?


#4

To be honest I am not completely sure. I know a lot of these lessons have specific coding behind them so as to allow the lessons to teach certain concepts without the user having to do a lot of extra code unnecessary to the lesson. However, it also could be that s can only has two values like a boolean is true and false s is yes and no. I mean just practically speaking you either shutdown or you don't so I don't see what other values s could possibly be. And of course it could be a combination of both I am just merely speculating xD.

However, I am glad this helped solve your code and I wish you best of luck with the rest of Functions! :smiley:


#5

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