SyntaxError: unindent does not match any outer indentation level

1

What should I do when this error message appears: "SyntaxError: unindent does not match any outer indentation level"?

I can not declare the else of the variable. Here is a print of the problem and the code:

escada = 'Sim'
if escada == 'Sim':
    print('Subir na escada e trocar a lâmpada')
else:
    print('Suba na cadeira')
    
asked by anonymous 29.08.2017 / 00:12

2 answers

-1

We actually have a syntax error, this code works.

escada = "Sim"
if escada:
   print("Subir na escada e trocar as lampadas")
else:
   print("Va pegar as escadas")

>>> 'Subir na escada e trocar as lampadas'
    
30.08.2017 / 04:05
-1

Indentation error, python because it does not have keys, is a sensitive language when declaring conditionals, functions, among others. So, the correct way would be:

escada = "Sim"
if (escada):
    print("Subir na escada e trocar as lampadas")
else
    print("Vá pegar as escadas")
    
29.08.2017 / 02:06