17 Review: Functions :( please help


#1



I have no idea what is wrong with my code :frowning: Please help me fix this...


error messages.:
File "python", line 3
return "Shutting down"
^
IndentationError: expected an indented block


 def shut_down(s):
     if s == "yes":
     return "Shutting down"

    elif s == "no":
     return "Shutdown aborted"

    else:
     return "Sorry"


#2

Indent your code properly..like this..

def some_function():
    if condition1:
        # your code.
    elif condition2:
       # your code
    else: 
        # your code

4 spaces!


#3

Thank you >.<
its working now


#4

Hi @paolalaborda
You've just seen that How indentation can make your code to not work properly?
So Im putting few reads(Articles) here..

http://www.annedawson.net/Python_Spaces_Indentation.html
http://www.peachpit.com/articles/article.aspx?p=1312792&seqNum=3
http://www.secnetix.de/olli/Python/block_indentation.hawk


#5

Thank you for your help :slight_smile:


#6

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