Duplicate events
The radio link from the capsule plays it safe: when it isn't sure an event arrived, it sends it again. Mission Control would rather get an event twice than not at all, but the event board must show each one once.
Drop the repeated events, then report which ones were repeated.
Finish stage 1 to unlock this stage.
Print each event once, keeping the first copy, and count the copies you dropped:
EV-1001 Hatch closed EV-1002 Cabin pressure nominal EV-1003 Abort system armed EV-1004 Switched to internal power Duplicates dropped: 2
Keep the IDs you have already printed in a set: start with seen = set(), skip an event whose ID is in seen, and seen.add() the ID of every event you print.
Finish stage 1 to unlock this stage.
The link engineers want to know which IDs came in more than once. Collect them in a second set and print them sorted, or none:
EV-1001 Hatch closed EV-1002 Cabin pressure nominal EV-1003 Abort system armed EV-1004 Switched to internal power Duplicates dropped: 2 Repeated IDs: EV-1001, EV-1002
Add the ID to repeated where you count a duplicate. An event sent three times is still one repeated ID.
Hints
Set Operations
# Objects a ground station is currently tracking
tracking = {"Juno", "Gaia", "Lucy"}
# add() puts one new item in
tracking.add("Psyche")
print(tracking)
# Adding something already there changes nothing and raises nothing
tracking.add("Juno")
print("Still", len(tracking), "objects")
# update() adds several at once
tracking.update({"Hera", "JUICE"})
print(tracking)
# remove() deletes, but complains loudly if the item is missing
tracking.remove("Gaia")
print("Gaia retired, now tracking", len(tracking))
# tracking.remove("Gaia") # delete the hash sign to meet a key error
# discard() deletes the same way, but stays quiet when the item is absent
tracking.discard("Gaia")
tracking.discard("Voyager 3")
print("Nothing broke:", len(tracking), "objects")
# pop() removes one item and hands it back, but you do not choose which
dropped = tracking.pop()
print("Signal lost with:", dropped)
# clear() empties the whole thing
tracking.clear()
print("End of shift:", tracking)
Separate arguments with commas. They're passed on every Run as sys.argv[1:].