Code seems correct but nothing is displayed after I press Run


#1
def shut_down(s):
  if s == "yes":
    return "Shutting down."
    
  elif s == "no":
    return "Shutdown aborted"
  else:
    return "Sorry"
    s == "yes"
  

#2

There’s nothing there to tell python to print something, so it would be very surprising if something was displayed.
Also, the indentation is all mangled, and those aren’t ascii quotes, python won’t like them.

Won’t run at all, as you can see below. Please use the buttons in the post editor to make the code display correctly in your post.


#3

Sorry, here it is well formatted.


#4

Right. But the idea with posting them is so that others can see the same thing.

Anyhow, like mentioned. No prints, no output to be expected. That code creates a function and then it exits, that’s all that happens.


#5

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