SyntaxStudy
Sign Up
Python Beginner 6 min read

Python Syntax

Python Syntax

Python uses indentation to define code blocks, unlike curly braces in other languages.

Basic Syntax Rules

  • Indentation matters (4 spaces is standard)
  • No semicolons needed
  • Case-sensitive
  • Comments start with #
if True:
    print("Indented block")
    print("Same block")
print("Outside block")
Pro Tip

Mixing spaces and tabs causes IndentationError in Python 3.