Python 3 Tutorial · Chapter 3 of 22
Python Syntax
The basic shape of a Python program.
Python programs are sequences of statements. Indentation marks blocks.
Comments start with #. Strings use quotes. Functions and control flow end with a colon.
There is no required main() for simple scripts — top-level code runs immediately.
Syntax skeleton
Try it Yourself »
# statement area
print("Syntax matters.")
Classroom Tips
- Indent with 4 spaces consistently.
- A missing colon after if/for/while is a common beginner error.