Where this course goes (and where you fit) — step 9 of 9
One last thing before we move on. Same surface as a write step — but the lesson doesn't complete until this passes.
Final drill of chapter zero. Write route_learners(learners) that
takes a list of learner profile dicts and returns a dict with two
keys:
routes: a list of tuples(name, starting_chapter, target_chapter_at_30_days), in the same order as the input list.by_background: a dict mapping background string -> integer count of learners with that background.
Reuse the same routing rules from the previous lesson:
- Engineer: starts at ch04, weekly_chapters = max(2, hours // 5).
- Designer: starts at ch01, weekly_chapters = max(1, hours // 7).
- Copywriter, cs_rep, paralegal: start at ch01, weekly_chapters = max(1, hours // 8).
- target_chapter_at_30_days = min(30, starting_chapter + 4
- weekly_chapters - 1).
Five learners run, one per background. Expected output:
routes:
('Maya', 4, 19)
('Devon', 1, 8)
('Priya', 1, 4)
('Jules', 1, 8)
('Sam', 1, 4)
by_background: {'engineer': 1, 'copywriter': 1, 'cs_rep': 1, 'designer': 1, 'paralegal': 1}
One last thing before we move on. Same surface as a write step — but the lesson doesn't complete until this passes.
Final drill of chapter zero. Write route_learners(learners) that
takes a list of learner profile dicts and returns a dict with two
keys:
routes: a list of tuples(name, starting_chapter, target_chapter_at_30_days), in the same order as the input list.by_background: a dict mapping background string -> integer count of learners with that background.
Reuse the same routing rules from the previous lesson:
- Engineer: starts at ch04, weekly_chapters = max(2, hours // 5).
- Designer: starts at ch01, weekly_chapters = max(1, hours // 7).
- Copywriter, cs_rep, paralegal: start at ch01, weekly_chapters = max(1, hours // 8).
- target_chapter_at_30_days = min(30, starting_chapter + 4
- weekly_chapters - 1).
Five learners run, one per background. Expected output:
routes:
('Maya', 4, 19)
('Devon', 1, 8)
('Priya', 1, 4)
('Jules', 1, 8)
('Sam', 1, 4)
by_background: {'engineer': 1, 'copywriter': 1, 'cs_rep': 1, 'designer': 1, 'paralegal': 1}
this step needs the editor
on desktop today; in the app (coming soon). save your spot and we'll bring you back here when you're ready.