Advanced · 4 labs
Walk topic trees, XP lists, and nested curricula with recursion — how Sythra orders lessons behind the scenes. Every lab must use a recursive solution (no for or while in your function).
Total labs
4
Completed
0
Remaining
4
Progress
0%
In this track
0 / 4 done
Before a streak resets, Sythra shows a countdown from n down to 0. Write countdown(n). Return a list [n, n-1, ..., 0] using recursion only (no for or while loops in countdown). Examples - countdown(3) → [3, 2, 1, 0] - countdown(0) → [0] - countdown(1) → [1, 0]
Not started · 0%
Sythra totals XP from a list of lesson rewards recursively. Write sum_lesson_xp(xps). Add all integers in xps using recursion only. Empty list → 0. Examples - sum_lesson_xp([10, 20, 30]) → 60 - sum_lesson_xp([]) → 0 - sum_lesson_xp([5]) → 5
Not started · 0%
Topics unlock in order on Sythra. prereqs maps each topic to its prerequisite topic, or None if there is none. Write prerequisite_chain(topic, prereqs). Return the learning order as a list ending at topic — prerequisites first. Example: prereqs = {"B": "A", "C": "B"} and topic "C" → ["A", "B", "C"] Use recursion only in prerequisite_chain. Examples - topic with no entry in prereqs → [topic] - three-deep chain as above - single topic "Loops" with empty prereqs → ["Loops"]
Not started · 0%
Course catalogs nest modules inside modules on Sythra. Write count_lessons(curriculum). curriculum is a nested list: each item is either a lesson name (str) or a sublist of more items. Count only string lessons (not sublists themselves). Use recursion only. Examples - count_lessons(["A", "B"]) → 2 - count_lessons(["A", ["B", "C"], "D"]) → 4 - count_lessons([]) → 0 - count_lessons([[]]) → 0
Not started · 0%