← Back to Error Guide
IndentationError

How to Fix IndentationError

Understanding and resolving IndentationError in Python

What is IndentationError?

An IndentationError happens when the code's indentation is not consistent. Python relies on indentation to determine the structure of code.

Common Causes

Common causes of this error...

How to Fix

Wrong Code

# Code that causes the error
if True:
print('Hello, world!')

Correct Code

# Fixed code
if True:
    print('Hello, world!')

More Python Error Guides