Section 1.1: Python Foundations
Before a program can do anything interesting it has to hold values and know what they are. A number, a piece of text, a true-or-false answer, and the explicit nothing that means "no value here" behave differently under the same operator, and the difference is not cosmetic: adding two numbers and adding two pieces of text produce different kinds of result, and adding one of each produces an error. This section covers running Python at all, the core types, the names you bind values to, and the operators and conversions that let those values interact predictably.
Module 0 gave you a machine you can drive, a shell that runs commands and a way to keep your work. What it did not teach is the language its Python scripts were written in, because those scripts existed to show a process starting or a file surviving. This section is where that changes, and it starts at the smallest possible unit, because every later structure in this module is built out of typed values bound to names.
Lessons
- Running Python - The Interpreter, the REPL, and Your First Script - the two main ways to execute Python and when each one is the right choice.
- The Core Data Types - Numbers, Text, Booleans, and Nothing - what each type holds and how it behaves.
- Variables - Naming, Assignment, and Rebinding - how a name comes to point at a value, and what happens when it is pointed somewhere else.
- Operators and Type Conversion - Making Values Interact - combining values, and converting between types deliberately rather than by accident.
By the end you will be able to:
- Run Python as an interactive session and as a saved script, and say why you chose one.
- Name the type of any value and predict how an operator will treat it.
- Predict what a chain of assignments leaves each name pointing at.
- Convert between types on purpose, and explain what a failed conversion tells you.