Python Foundations: Variables, Loops, Functions & Files
Learn Python by thinking like the interpreter: trace variables, strings, lists, loops, dictionaries, functions, files and error handling for a fictional bike rental, with every answer checked as you go.
- One-time payment
- Instant access right after payment
- Secure checkout with Stripe
About this course
In this beginner course you learn Python by thinking like the interpreter. Each of the 20 labs shows a short script for a fictional bike rental next to its data, and you work out what the code produces: variable values, string slices, list changes, loop traces, dictionary counts, function return values, file contents and the result of try/except. Every answer is a formula that is checked instantly, also with changed data, so guessing does not work. You meet the classic beginner traps, such as floor division with negatives, off-by-one loop conditions and functions without return, and finish with a daily report project and a certificate exam.
Lessons
- Your First Script: Variables, Arithmetic and print()Free
- Numbers: int, float, //, % and ** Locked
- Types and Conversion: str, int, float and type() Locked
- Strings I: Indexing, Slicing and len() Locked
- Strings II: Methods, split() and f-strings Locked
- Comparisons and Booleans: and, or, not Locked
- Decisions: if, elif and else Locked
- Lists: Index, Slice, append(), pop() and insert() Locked
- for Loops and range() Locked
- while Loops: Repeat Until a Condition Fails Locked
- Loop Patterns: Counters, Accumulators, break and continue Locked
- Dictionaries: Counting and Summing by Key Locked
- Sets, Tuples and Membership Locked
- Functions: def, Parameters, Defaults and return Locked
- Functions II: Composition, Return Values and Scope Locked
- Built-in Helpers: sum, max, sorted, zip and enumerate Locked
- Reading Files: open(), with and Parsing Lines Locked
- Writing Files: write(), Modes "w" and "a", and Newlines Locked
- Handling Errors: try, except and Clean Input Locked
- Final Project: The Daily Rental Report Locked