I am a newbie in python. I wanted to return string "shutting down" if s==yes. Pls tell me what could be wrong in the below code.
def shut_down(s):
... if s == "yes":
File "", line 2
if s == "yes":
^
IndentationError: expected an indented block
解决方案
tl;dr try to add 4 spaces to the start of your second line like this:
def shut_down(s):
if s == "yes"
It is recommended to use 4 spaces for indentation in Python, tabulation or a different number of spaces may work, but it is also known to cause trouble at times. more on that can be read on PEP8.
I'm not exactly sure how you tried to indent your second line, but it is important to note that most modern Python IDEs will automatically replace your tabs with 4 spaces, which is great if you're used to tabbing (I personally use PyCharm, but IDLE does that as well).