Quick Answer
Fix inconsistent indentation (spaces vs tabs) that breaks Python's block structure.
Understanding the Issue
Python uses whitespace for block delimitation. The interpreter raises IndentationError when it encounters inconsistent spacing (commonly mixing tabs and spaces) or incorrect nesting levels. This differs from brace-delimited languages and requires proper editor configuration.
The Problem
This code demonstrates the issue:
Python
Error
def faulty():
print("Missing indent") # Error
print("Over-indented") # May not match outer level
The Solution
Here's the corrected code:
Python
Fixed
# Solution: Standard 4-space indentation
def correct():
print("Properly indented")
if True:
print("Nested block")
Key Takeaways
Configure your editor to show invisibles and enforce 4-space indentation.