Skip to content
Advertisement

If statement not wirking, python

 if number == 1:  
    print("One")  
    print("To exit type 'exit'.")

 exit = raw_input()    
    if exit == "exit":       
    print("Welcome back.")    

I am getting error on the if exit == “exit”: line… (Using python 2) The full error is : ‘unindent does not match any outer indentation level’

Advertisement

Answer

Did you try like this:

def raw_input():
    return "exit"
number = 1
if number == 1:  
    print("One")  
    print("To exit type 'exit'.")
exit = raw_input()    
if exit == "exit":       
    print("Welcome back.")  
Advertisement