...

Chapter 15 - Python Quest

Tower of Hanoi Recursion

Move smaller towers, pause calls with changing peg roles, and combine each recursive plan on the return trip.

XP
0Level 1
Stars
0/15quest stars
Combo
0clean runs
Rank
Seed0/160 Python score
First recursive function

Rocket Countdown Chain

100 XP

A launch computer builds its countdown by asking a smaller launch computer to finish the rest of the numbers.

Write recursive_countdown(number) so it returns [number, number - 1, ..., 1]. Return [] for 0. Solve it with recursion and no for or while loop.

Sample checks

recursive_countdown(4)returns[4,3,2,1]

Explanation: the 4 call keeps 4 in front, then the smaller 3 call contributes 3, 2, 1 as its complete returned countdown

recursive_countdown(1)returns[1]

Explanation: the 1 call contributes its current number, while the smaller 0 call reaches the stopping case and contributes an empty list

Hint

Hints are ready when you want one.

Lesson reference

Review: Shrink toward the base case

Your Python

recursive_countdown

Loading editor

Judge

Ready

0/5

Run your code when it feels ready.