The indentation in Python
must be respected so that the code is executed in perfect block.
Just add a tab
or 4 espaços
[1] on lines running within 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 that code on it codeacademy
and it worked. You can test the pythonfiddle also.
Indentation is a predominant feature in the language Python
.
While code blocks are explicitly delimited in C
, Java
and PHP
by keys, in Pascal
and Fortran
by keywords such as then
and endif
, in Python
blocks are delimited by spaces or tabulations forming a visual indentation, there are no symbols(in fact, the symbols, are the tabulations 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 C/C++
or JavaScript
, indentation is not required due to block delimiters, being used only for better visualization.
Somebody help me out??
– user28833
That’s my favorite thing about Pyhton. It forces the guy to be organized :) pity that it still leaves to make code crude, redundant :( The Codeacademy teaches it? Good to know for me not to indicate.
– Maniero