Teacher-curated, self-paced courses. Looking for a guided sequence through a full topic? See Learning Paths.
Recursion is a function that calls itself on a smaller problem. It sounds strange at first, but it is how we naturally think about problems that contain smaller copies of themselves: a folder inside a folder, a word whose last part is a shorter word, a tower of discs that holds a smaller tower. In this course you find the base case that stops the calls, write countdowns, sums, factorials, powers and Fibonacci numbers, follow the call stack going down and coming back up, and see why the simple Fibonacci function is slow. You use recursion on text and lists, and you finish with a project that walks through folders inside folders. The practice runs your functions on many inputs and tells you which ones fail.
A monk moves a tower of discs, one at a time, and the legend says the world ends when he is done. How many moves is that? Why is the simple Fibonacci function so slow, and how does a dictionary fix it? In this workshop you learn a way to think recursively with four questions, solve puzzles on lists, numbers and towers, keep a memory of answers, learn the limits of recursion and when to use a loop, and meet puzzles where every step has a choice, such as all the subsets of a set and all the arrangements of letters. A puzzle book of tested functions is the project at the end, and a timed test follows. The practice runs your functions on many inputs and tells you which ones fail.