+ 1
python indentation errors?
3 Respuestas
+ 4
what exactly is your question? what they are? because indentation errors is where you don’t use the correct indentation (how far the code is to the right)
for example:
if var == True:
print(“yup”)
the difference between where if is on the line (the start) and the print statement (one tab or four spaces) is what we call indentation (specifically the spaces)
it shows us/it has us show the IDE where specific bits of code are. Code within an if statement needs to be “within” the if statement or indented as we say.
other languages use {} to do this
for example
for(int i = 0; i < 5; i++)
{
some code written here
}
an indentation error in python would be
for i in range(5):
print(i)
note the missing spaces before print, so print is not indented correctly
+ 2
Sonic . Yep. Indentation size doesn't seem to matter.
You don't even have to be consistent with the size.