+ 3

What causes indentation error

It always pops up when I put two the same actions on the same row

31st Dec 2018, 7:03 AM
Victor Asagba
Victor Asagba - avatar
4 Answers
+ 17
From the SoloLearn's python tutorial: "Python uses indentation (white space at the beginning of a line) to delimit blocks of code. Other languages, such as C, use curly braces to accomplish this, but in Python indentation is mandatory; programs won't work without it. As you can see, the statements in the if should be indented." Basically you need indentation every time you make a block of code
31st Dec 2018, 8:11 AM
Uni
Uni - avatar
+ 8
Basically, if a line ends in a colon, the next line must be indented. If you post a link to the code you wrote, we can give you a better answer about why you are getting the error.
31st Dec 2018, 9:25 AM
David Ashton
David Ashton - avatar
+ 3
Be careful and don't mix spaces and tabs when you're doing indentation. A space followed by a tab May look like a single indentation but it's actually two levels of indentation. This has cause me some problems when combining different pieces of Python code. A good IDE he will help you fix it. even "idle" is good with Python indentation problems.
1st Jan 2019, 12:01 AM
Rick Shiffman
Rick Shiffman - avatar