Advanced · 4 labs
Practice loops the way Sythra uses them — while loops for grinding XP, for loops for tallies and streak scans, and retry patterns like a do-while.
Total labs
4
Completed
0
Remaining
4
Progress
0%
In this track
0 / 4 done
Some Sythra labs stay locked until you have enough XP. Every study session earns the **same** amount of XP. Your job: write `sessions_to_unlock(current_xp, target_xp, xp_per_session)` and return **how many sessions** you need. **What to do (in plain English)** 1. Start with the student's current XP (`current_xp`). 2. **While** XP is still below the target, pretend they complete one session: - add `xp_per_session` to XP - add `1` to a session counter 3. When XP reaches the target (or goes past it), return the counter. 4. If they already have enough XP, return `0` — no sessions needed. **Walkthrough — Example 1** `sessions_to_unlock(80, 100, 25)` - Start: 80 XP, need 100 → not enough yet - After 1 session: 80 + 25 = **105** XP → done - **Answer: 1** **Walkthrough — Example 2** `sessions_to_unlock(100, 100, 25)` - Start: 100 XP, need 100 → already there - **Answer: 0** **Walkthrough — Example 3** `sessions_to_unlock(0, 100, 40)` - Session 1: 0 + 40 = 40 (still below 100) - Session 2: 40 + 40 = 80 (still below 100) - Session 3: 80 + 40 = 120 (reached!) - **Answer: 3** Use a **while** loop inside your function.
Not started · 0%
Every time you finish a lesson on Sythra, you earn blossoms. Your profile shows the **total** across the week. Write `total_blossoms(rewards)` where `rewards` is a list of integers. **Rules** - Use a **for** loop to walk the list - Return the sum of all values - An empty list returns `0` **Examples** - `total_blossoms([2, 3, 5])` → `10` - `total_blossoms([])` → `0` - `total_blossoms([1])` → `1`
Not started · 0%
Sythra tracks which days you finished a lab this week. The dashboard shows how many **completed** days you had. Write `weekly_lab_count(completed_days)` where `completed_days` is a list of booleans (`True` = lab finished that day). **Rules** - Use a **for** loop - Count how many values are `True` - Ignore `False` entries **Examples** - `weekly_lab_count([True, False, True])` → `2` - `weekly_lab_count([False, False])` → `0` - `weekly_lab_count([])` → `0`
Not started · 0%
After a lesson, Sythra lets you retry a quiz until you pass — like a **do-while**: you always attempt at least once, then keep going while you're still below the passing score. Write `attempts_until_pass(scores, passing_score)`. **Rules** - `scores` is a list of quiz scores (non-empty) - Process scores **in order** - Count each attempt (start at 0, add 1 per score) - Return the attempt number when a score is **greater than or equal to** `passing_score` - If none pass, return the total number of attempts (length of the list) **Examples** - `attempts_until_pass([40, 55, 70], 60)` → `3` (pass on third try) - `attempts_until_pass([80], 60)` → `1` - `attempts_until_pass([10, 20, 30], 60)` → `3` (never passed) Use a loop — think "keep trying while still failing."
Not started · 0%