Indentation

Python code blocks and structure

Interview Relevant: Python-specific syntax

Indentation

Crucial! Python uses whitespace to define code blocks, not curly braces.

Code Examples

Blocks defined by indentation.

python
1if True:
2    print("Indented")  # 4 spaces (standard)
3    if True:
4        print("Nested")
5print("Outside")

AI Tutor

Ask about the topic

Sign in Required

Please sign in to use the AI tutor

Sign In