Python from the ground up, traced one line at a time: names and objects, strings, loops, lists and dictionaries, functions, classes, errors and generators.
Python · beginner · 28 lessons · 3 h 19 min · free
What you'll learn
See that a variable is a name pointing at an object, not a box holding a value
Trace every kind of loop and branch one step at a time
Use lists, tuples, dictionaries, sets and comprehensions with confidence
Watch function calls, recursion, classes and generators in memory
Lessons
Python Basics
Names and objects, numbers, text, and true or false.
Variables: Names for Objects: In Python a variable is a name stuck onto an object. Watch names get created, move to new objects, and share one object.
Numbers and Arithmetic: Integers, floats and every arithmetic operator, including the three kinds of division people mix up.
Strings: Indexing and Slicing Text: Pick out characters by position, cut out slices, and see why string methods return new strings instead of changing the old one.
f-strings: Putting Values into Text: Put variables and expressions straight into text, and control decimals and alignment with format specs.
Booleans, Comparisons and Logic: True and False, comparison operators, and/or/not, chained comparisons, and which values count as false.
Control Flow
Branching with if, and repeating with while and for.
if, elif and else: Choose between several branches. Python checks each condition in order and runs only the first one that is true.
while Loops: Repeat while a condition stays true. Watch the condition being checked before every round, and the loop stop once it turns false.
for Loops, range and enumerate: Repeat once per item: numbers from range, counting down with a step, and getting both position and item with enumerate.
break and continue: Skip one round with continue, or leave the loop early with break, on a list of sensor readings.
Nested Loops: A loop inside a loop: for every row, the inner loop runs all the way through. Build a 3 × 3 times table.
Collections
Lists, tuples, dictionaries and sets, and what assignment really does to them.
Lists: Adding, Removing and Sorting: A list is an ordered, changeable collection. Use a queue of people to try append, insert, pop, remove and sort.
Slicing Lists: Take parts of a list with [start:stop:step], reverse it, and copy it so changes do not leak back.
Two Names, One List: Assigning a list to a second name does not copy it. Watch two names share one list, then see how copy() makes a separate one.
Tuples and Unpacking: Tuples are fixed-size, unchangeable groups. Unpack them into names, swap two values in one line, and collect "the rest" with a star.
Dictionaries: Keys and Values: Store values under keys: add, update, look up safely with get, delete, and loop over pairs with items().
Sets: Unique Items: Sets keep each value once. Remove duplicates in one step and compare groups with &, | and -.
List and Dict Comprehensions: Build a list in one readable line. Compare a loop with its comprehension, then add a filter, and build a dictionary the same way.
Functions
Defining and calling functions, arguments, scope, recursion and lambdas.
Functions: Define, Call, Return: Package code under a name, call it with arguments, and get a value back. Watch a new frame appear for each call.
Default and Keyword Arguments: Give parameters default values, then call the same function four ways: positions, defaults, and names.
Scope: Local and Global Names: Names made inside a function live only during the call. Read a global from inside a function, and change one with the global keyword.
Recursion: Functions That Call Themselves: factorial(4) calls factorial(3), which calls factorial(2)… Watch the frames stack up until the base case, then unwind with the answers.
lambda, map, filter and sorted: Small throwaway functions for sorting by a key, changing every item, and keeping some items.
Objects, Errors and Generators
Classes, inheritance, special methods, exceptions and generators.
Classes and Objects: A class is a blueprint; objects are made from it, each with its own data. Build two bank accounts and see self in action.
Inheritance and super(): A Dog is an Animal; a Puppy is a Dog. Child classes reuse the parent's code, override what differs, and extend it with super().
Generators and yield: A generator hands out values one at a time and pauses in between. Watch it freeze at each yield and pick up exactly where it left off.
Related courses
Core Java Fundamentals: Learn Java from the ground up: how the JVM runs your code, data types, operators, conditionals, loops, methods, arrays, strings, object-oriented programming and exceptions. Every lesson traces a real program line by line. (44 lessons, 10 h 11 min)
Advanced Java: Collections, Generics and More: The Java you need beyond the basics: lists, stacks, queues, maps and sets, iterators, generics, ordering, equals and hashCode, enums, nested classes, immutability and resources. Every lesson traces a real program line by line. (14 lessons, 1 h 41 min)
Modern Java 8+ Features: Lambdas, functional interfaces, streams, Optional and the date-time API from Java 8, plus var, records and modern switch from later versions. Every lesson traces a real program line by line. (13 lessons, 1 h 35 min)
Java Interview Questions: Classic Java interview programs, traced line by line with the reasoning behind each step. (4 lessons, 1 h 10 min)