我是Python新手。我想返回字符串“shutting down” if s==yes
。请告诉我下面的代码中可能有什么问题。
def shut_down(s):
... if s == "yes":
File "<stdin>", line 2
if s == "yes":
^
IndentationError: expected an indented block
最佳答案
我假设您是Python函数定义的初学者,定义函数的正确方法是:
#function definition
def shut_down(s):
if s=="yes" :
print("right")
return
shut_down("yes") #calling the function
在函数调用期间,您将“yes”分配给s变量。
关于python - 缩进错误 : expected an indented block python 3. 6,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44612393/