Variables, Values and Operators
- Names and values. A Python variable is a name bound to a value: assignment points the name at an object, it does not copy it.
- Dynamic typing. Types belong to values, not to names: the same variable may point at a number now and a string later.
- Operators. Operators like plus, percent and power build new values, and the double-slash operator performs floor division, dropping the remainder.
Strings, Numbers and Booleans
- Strings. A string is immutable text: every method like upper or replace returns a new string, never edits the old.
- Numbers. Python keeps int for whole numbers of any size and float for decimals: integer overflow simply does not exist.
- f-strings. An f-string embeds expressions right inside text: f"Hello {name}" fills the braces with live values.
Reading and Writing Python
- Indentation as syntax. Indentation IS the syntax: a block is defined by its consistent leading spaces, and mixing levels is an error.
- Statements and lines. One statement per line is the Python idiom; the colon at a line’s end announces an indented block follows.
- Pythonic style. Code that follows the community’s PEP 8 conventions: clear names, small functions: is what colleagues call Pythonic.
Before and after this level
- Before: Start Here: Think in Python: What Python Is Used For, Interpreter, Scripts and Interactive Python.
- Next: Level 2: Decisions & Loops: Conditions, Iteration and Loops, Writing Clear Program Flow.
In the app each of these ideas is taught and then asked back, and the level ends with a checkpoint and flashcards. See Checkpoints and flashcards.
Frequently asked questions
What does Python Level 1: Python Foundations cover?
Variables, Values and Operators, Strings, Numbers and Booleans, Reading and Writing Python: 3 lessons and 9 ideas.
What should I know before this level?
The level before it, Start Here: Think in Python, which covers What Python Is Used For, Interpreter, Scripts and Interactive Python.