Pranav Sharma
Pranav Sharma

Reputation: 232

"Unindent does not match any outer indentation level" in Python

I have some Python code that does not run. The error message says:

unindent does not match any outer indentation level

def main1():       

        password = "LPPJJAS"
        user_input = raw_input('Please Enter Password: ')

        if user_input == password:
                print 'All distances have been split so one pixel is equal to two centimetres'
               time.sleep(1)


        elif user_input != password:
                print 'Incorrect Password, terminating... \n'
                exit("pow")

if __name__ == "__main__":
        main1()`

Upvotes: -1

Views: 2115

Answers (1)

weirdev
weirdev

Reputation: 1398

There is an extra space before line 5 - print 'All distances.... Python expects equal indents for every line. (Usually 4 spaces.)

password = "LPPJJAS"
user_input = raw_input('Please Enter Password: ')

if user_input == password:
    print 'All distances have been split so one pixel is equal to two centimetres'
    time.sleep(1)

elif user_input != password:
    print 'Incorrect Password, terminating... \n'
    exit("pow")

Upvotes: 1

Related Questions