Python Foundations
Learn Python from nothing at all. No programming experience assumed: every concept arrives as the answer to a problem you can feel, from your first line of code to a small program you actually run. Ends with a real command-line tool you wrote yourself.
Start courseWhat you will cover
- Why Python and What Happens When You Run ItWhat a programming language is for, what actually happens between saving a file and seeing output, and the difference between typing at the interpreter and writing a program that lasts.25 min
- Installing Python Without Breaking Your MachineWhy your computer may already have a Python you should not use, how versions coexist, and getting to a working setup you can trust on macOS, Windows or Linux.25 min
- Values, Names, and TypesWhat a variable really is in Python — a name attached to a value, not a box holding one — plus the basic types, why the distinction between them matters, and what None is for.25 min
- Strings and TextBuilding and shaping text: f-strings, the string methods worth memorising, why a string can never be changed in place, and what happens when text is not plain English.25 min
- Numbers and Arithmetic That Surprises YouIntegers that grow without limit, decimals that cannot represent 0.1 exactly, floor division and modulo, and when money needs a different type altogether.25 min
- Making Decisions with Conditionsif, elif and else; comparison versus equality; what Python considers true when the thing is not a boolean; and combining conditions without creating something nobody can read.25 min
- Lists and TuplesOrdered collections you can change and ones you cannot: indexing, slicing, growing a list, and the aliasing surprise where two names turn out to share one list.25 min
- Dictionaries and SetsLooking things up by name instead of position, handling a key that is not there, and using a set when membership and uniqueness are the whole point.25 min
- Loops That Do Not Run AwayRepeating work over a collection, repeating until something changes, and the loops that never finish. enumerate and zip, and why you rarely need an index in Python.25 min
- Functions, Arguments, and Return ValuesNaming a piece of work so you can reuse it: parameters, defaults, returning values, and the mutable default argument that catches every Python programmer exactly once.25 min
- ComprehensionsBuilding a list, dict or set from another in one readable line — and recognising the point where a comprehension has become worse than the loop it replaced.25 min
- When Things Go Wrong: ExceptionsReading a traceback, catching only what you can handle, and why except Exception hides the bug you most needed to see. try, except, else and finally, and raising your own.25 min
- Reading and Writing FilesOpening files so they always close, text versus bytes, encodings and the errors they cause, and building paths that work on any operating system.25 min
- Organising Code into ModulesSplitting one long file into several that import each other, what the if __name__ line is really doing, and a project layout that will not fight you later.25 min
- Objects and ClassesThe problem classes solve — data and the behaviour that belongs to it in one place — how to write one, and the many cases where a function and a dictionary are the better answer.25 min
- The Standard Library You Will Actually UseA tour of what ships with Python and saves you writing it: pathlib, datetime, json, collections, itertools, random and argparse, each shown solving a real task.25 min
- Your First Real Python ProgramBuilding a small command-line tool end to end: arguments, files, error handling, structure and a first test — putting every earlier lesson into one thing that works.25 min