Teacher-curated, self-paced courses. Looking for a guided sequence through a full topic? See Learning Paths.
So far, one variable held one value. A class has thirty marks, a shop has a hundred prices, and you cannot make a hundred variables. A list holds many values in one variable. In this course you make lists, read them by position and by slice, add, remove, replace and sort items, go through a list with a loop, and find totals, averages, the biggest and the smallest. You learn why a copy of a list is not what you expect, and how to make a table with a list inside a list. A marks tracker is the project at the end. The practice runs your code on real lists and tells you which results are wrong.
A computer does not get tired. A loop lets it repeat the same lines a hundred, a thousand or a million times, while you type them only once. In this course you learn the for loop, the range() function that makes a row of numbers, how a loop builds an answer such as a sum, a count or a factorial, and how to put one loop inside another to make tables and patterns. A project at the end prints a multiplication table book. The practice runs your loops and tells you which results are wrong.
A for loop is for a number of rounds that you know. A while loop is for the cases where you do not know: keep saving until there is enough, keep asking until the answer is right, keep going until something happens. In this course you write while loops, learn what makes them stop, leave a loop early with break, skip a round with continue, and ask the user again and again. A lesson on the loops that go wrong shows how to choose between for and while, and how to find an endless loop and a loop that is off by one. A guessing game with hints and a limit of tries is the project. The practice runs your loops and tells you which results are wrong.