30/30
Part 7 of 7 · Follow-upsCheck yourself
Check yourself
6 questions
  1. 1.The catalog is {Maple: 7, Harbor: 7, Comet: 9}. What does sorted(catalog, key=lambda t: (catalog[t], t), reverse=True) return?

  2. 2.Comet and Harbor have shown. Tundra rises from 3 to 10, and the billboard sorts its list again and keeps its cursor at 2. What goes wrong?

  3. 3.Comet has already shown in this loop. Its score drops from 9 to 1. Where does its new key go?

  4. 4.Why does a lazy-delete heap need the dict of current scores?

  5. 5.Three titles A, B and C showed in calls 1, 2 and 3, and the cooldown is 3. At call 4 every title is cooling. Which title shows?

  6. 6.Your billboard keeps scores in a Redis sorted set and reads them with ZRANGE ... REV. Maple and Harbor tie. Which comes first, and what's the fix?

Now the problem this lesson builds to: 56 A movie billboard that rotates titles by scorePractice it