What is the difference?


#1

What is the difference between using 1 tab indent and 2 space indents (space bar and tab button)? I used tab instead of 2 spaces and I got an error message. I decided to try spaces, and it worked. I’m very new to Python and both 1 tab and 2 spaces seem to do the same thing. What is the difference?


#2

As far as the Python interpreter is concerned, we can use either tabs or spaces, but should not mix them. Either use tabs only, or spaces only.

If ever you run into issues with indentation, remove all indents and replace with four spaces per block level (for CC courses) as that is the most typically expected by the SCT.