
Boss
Boss: The Glitch Gremlin

Boss Fight!
Every passing test breaks a shield.
The Glitch Gremlin has crept into the Guild's quest board and planted four bugs, one from each family you've met. The board crashes, quests share their tags, the purse says "too expensive" when it isn't, and saved snapshots change by themselves!
Use the detective method: read the clue, shrink the case, check your guess with a print or assert, then fix. Each of Pip's tests is named after one bug, so a red test tells you which family to hunt.
The bug reports
- The sticky default: every quest added without tags shares
one tags list, so it fills up with
"new","new","new"... Each quest must get its own list: given tags plus"new", even when two quests are given the same list (don't change the caller's list either). - The vanishing list:
top_quests(board, n)crashes withTypeError: 'NoneType' object is not subscriptable. It must return the titles of thenhighest-reward quests, best first, without reorderingboard. (sorted()makes a new list;.sort()returnsNone.) - The float trap:
can_afford(0.3, [0.1, 0.2])saysFalse. It should beTruewhen the prices add up to the wallet or less. Prices and wallets use coins with at most 2 decimal places. Allow for tiny float errors (tryround(..., 2)ormath.isclose). - The shared backpack: after
s = snapshot(board), changing a quest on the board also changess. The snapshot must be a completely independent copy, all the way down.
Assignment
Fix all four bugs. Keep the function names and arguments the same.
Fix all four bugs. Keep the function names and arguments the same.
main.py Python sleeping
Press Run to try your code, then Check to test it.