The second rule lives inside one row: no title twice. Rows come from different rankers, and a row can list one title twice, a show in two genres for example. The dedup keeps the first copy, because the row's order is its ranking, and the first copy is where the ranker wanted it.
dict.fromkeys does exactly that. A dict keeps its keys in the order they first went in, and a key that comes again changes nothing:
What does list(dict.fromkeys(['C', 'A', 'C', 'B', 'A'])) give?
Pick one to see what it prints.
sorted(set(row)) drops the repeats too, and loses the ranking. On a homepage that moves the wrong show to the front of the row. A plain set is worse: its order depends on the hashes, and string hashes change from one run of Python to the next.
A loop with a seen-set gives the same result as dict.fromkeys, and you'll write it that way when the loop has to do more, as it will in the next part.
In the editor, write unique_in_order(titles): each title once, at the place of its first copy, with the input left as it was.
Pick an answer above to see the rest
Instructions
1
Write unique_in_order(titles): each title once, at the place of its first copy.