3 Réponses
+ 5
Indentations are enforced in Python to group blocks of codes together. Mainly used in composing functions, conditional blocks, loops, etc.
The number of spaces you use for indentations has to be the same for lines grouped within the same block.
In other programming languages, curly braces are used in place:
if (condition)
{
// do something
}
Python:
if condition:
# do something
+ 2
Rule of thumb: when a line of code finishes with a colon, then 'at least the following line is intendated.
+ 1
Donna you are wrong, write code look at above and don't give space and you got "IndentationError"