Sythra
All tracks

Advanced · 4 labs

Sythra Router Lab: Case Statements

Route badges, plans, commands, and notifications with Python match and case — the same pattern Sythra uses to dispatch platform events.

Total labs

4

Completed

0

Remaining

4

Progress

0%

In this track

Labs

0 / 4 done

Lab 01Easy

Badge Namer

Sythra shows a friendly badge title from a single-letter code. Write badge_name(code). Rules - "S" → "Starter" - "B" → "Builder" - "M" → "Master" - anything else → "Unknown" Examples - badge_name("S") → "Starter" - badge_name("B") → "Builder" - badge_name("M") → "Master" - badge_name("X") → "Unknown"

Not started · 0%

Start →
Lab 02Easy

Plan Tier Perks

Billing plans unlock different perk messages on Sythra. Write plan_perks(plan). Rules - Normalize with .lower() on the input - "free" → "free tier" - "pro" or "premium" → "premium perks" (same case branch) - "team" → "team perks" - default → "no perks" Examples - plan_perks("FREE") → "free tier" - plan_perks("Pro") → "premium perks" - plan_perks("enterprise") → "no perks"

Not started · 0%

Start →
Lab 03Medium

Command Router

The Sythra CLI accepts short text commands. Your router splits and matches them. Write route_command(command). Split the command on whitespace into a list of parts, then match: - ["open", page] → open:{page} (exactly two words: open then a page name) - ["help"] → help - ["quit"] → quit - anything else → unknown command Empty or whitespace-only input → unknown command. Document these exact return strings in your solution: - open with a page → open:{page} (colon, no spaces) - help → help - quit → quit - else → unknown command Examples - route_command("open labs") → open:labs - route_command("help") → help - route_command("") → unknown command - route_command("open") → unknown command

Not started · 0%

Start →
Lab 04Hard

Notification Router

Sythra's notification center picks a short message from an event dict. Write route_notification(event). Use match on the dict with guards: - type streak and days >= 30 → gold streak alert - type streak (other days) → streak alert - type badge with a name key → badge:{name} (colon between badge and the name) - missing or unexpected shape → ignore Examples - {"type": "streak", "days": 30} → gold streak alert - {"type": "streak", "days": 5} → streak alert - {"type": "badge", "name": "Builder"} → badge:Builder - {"type": "ping"} → ignore - {} → ignore

Not started · 0%

Start →