The indentation in Python
must be respected in order for the code to be executed in block perfectly.
Just add a tab
or 4 espaços
[1] on the lines that execute within the conditional structures:
def the_flying_circus():
if 5==5:
return True //identar
elif 5!=5 or 6>=4:
return False //identar
else:
return False //identar
print the_flying_circus() //chamar função
I tested this code on codeacademy
itself and it worked. You can test on pythonfiddle as well.
Indentation is a prevalent feature in Python
language.
While code blocks are explicitly delimited in C
, Java
and PHP
for keys, Pascal
and Fortran
for keywords as then
and endif
, in% are delimited by spaces or tabs forming a visual indentation, there are no symbols (in fact, the symbols themselves are the tabs themselves or spaces) that indicate when the code of a given function starts, or ends.
For this reason, Python
requires a standardized indentation. In other languages, such as python
or C/C++
, indentation is not required due to block delimiters, and is only used for better visualization.