What's wrong? indentationerror


My code is as follows:
The error says there is an indentationError in line 4. What is an indentation exactly? I haven’t really grasped that concept yet.

def shut_down(s):
if shut_down(yes):
return “Shutting down”
elif shut_down(no):
return “Shutdown aborted”
return “Sorry”



indent refers to the amount of spacing at the beginning of the line, where many languages use curly brackets:

if (condition){
// code to execute

in python:

if condition:
    print "i need indent"

indent is used to determine nesting.

i would still indent in the first code sample for readability, but in python its mandatory given it determines nesting.


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