The problem arises from the fact that python doesn’t like it when you mix tabs and spaces for indentation. Python relies on whitespace a LOT to figure out the levels of indentation, and hence scope.
As a result, when you have a line that has two TABs on it, followed by a line with 4 SPACEs and a TAB, python proceeds to freak out and tell you that your indentation is off.
TL;DR: don’t mix tabs and spaces. Stick to one or the other, and you should be fine.
Fun aside: if you really /really/ REALLY wanted to ignore this tip and try to mix the two, I believe TABs are considered to be the equivalent of 8 SPACEs. So you could in theory do some indentation math there, to figure out how much to indent each line by, with a mix of the two. But this is HIGHLY unrecommended, and I’m probably going to burn in hell just for saying it
1
solved Python Indentation Error [closed]