Really need help!


#1

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

And this is the error:
File "python", line 3
return "Shutting down"
^
IndentationError: expected an indented block

What am I doing wrong?


#2

if you have a if/elif/else block:

if True:
   print True
elif False:
   print False
else:
   print None

see how the indent is? this shouldn't be new, now you could simply nest this block inside a function:

def example():
   if True:
       print True
   elif False:
       print False
   else:
       print None

#3

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