8/30
Part 2 of 7 · One loop at a timeLearn and do
An update breaks the cursor
Level 2 lets scores change between calls. Here's the cursor version after Comet and Harbor have shown, when Tundra's score jumps to 10 and the order is sorted again:
scores = dict(CATALOG, Tundra=10)
order = sorted(scores, key=lambda title: (-scores[title], title))
cursor = 2
print(order)
print(order[cursor:])
Comet and Harbor have shown, so the cursor is 2. Tundra rises to 10 and the list is sorted again. Which title does the cursor show next?
Pick one to see what it prints.
Pick an answer above to see the rest