Python TutorialLesson 3Free preview
Python Syntax
This lesson is part of Python · All levels
Summary
Python syntax is very concise because the rules of writing are very small and readily available. The code blocks in Python are not marked with curly braces, but by indentation (space distance at the beginning of the line). An indentation error will cause the program to stop with an IndentationError message.
Key points
- Each Python statement is usually on its own line.
- The code blocks are grouped by indentation, not curly braces.
- The colon the beginning of the block to be indented.
- PEP 8 suggests four spaces for each indentation level.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.