Skip to main content

Posts

Showing posts with the label The Crazy Programmer Solve IndentationError: unindent does not match any outer indentation level Solve IndentationError: unindent does not match any outer indentation level The Crazy Programmer

Solve IndentationError: unindent does not match any outer indentation level Pratik Sah The Crazy Programmer

Majority of the time new Python developers face one common problem and that is of IndentationError: unindent does not match any outer indentation level  and they are not able to figure out why this error occurred. In this post, I’ll be discussing some of the ways to overcome IndentationError . But before getting started, I’d like to tell you guys that Python is very strict about Indentation and if any of your code blocks is not indented, the interpreter is going to complain about the indentation. Let us see this with an example. print("Hello, World!") Here, you can see that the code has an extra space in front of it and when you’ll try to run your python file, this will throw an error. How to Solve the Error? Stop Using spaces The best way to avoid these kinds of error is to stop using spaces for indentation and start using tabs for indentation. When you mix spaces with tabs in your code, then the compiler throws an indentation error. Use of Tabs Use tabs in place