Lesson 4 / 47

Python Syntax

Indentation defines blocks — no braces.

Indentation is structure

Use 4 spaces per level. Mixing tabs and spaces is an error.

def greet(name):
    if name:
        print(f"Hi, {name}")
    else:
        print("Hi, stranger")

Statements & comments

One statement per line, no semicolon. # starts a comment. Names are case-sensitive.