The arrivals board has one flight per line: a flight code and a landing time, like "CA9 9:30". Write arrival_order(text) to sort them earliest first and return the codes. Turn each time into minutes after midnight before comparing (or "9:30" lands after "14:05"). No two times are the same.
arrival_order("MU5 14:05\nCA9 9:30\nZH2 9:05")→['ZH2', 'CA9', 'MU5']arrival_order("")→[]def arrival_order(text):
flights = []
for line in text.splitlines():
code, time = line.split()
h, m = time.split(":")
# your code here: put (minutes, code) into flights
# your code here: sort flights
return [code for minutes, code in flights]
Run tries the examples. When they look right, Submit.