Code seems correct but nothing is displayed after I press Run

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


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.


Sorry, here it is well formatted.


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.


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