question 68 Lists & Tuples · medium
Double-booked seats
A cinema's booking system received these seat bookings, each a (row, seat) tuple. A seat booked more than once is double-booked. Print each double-booked seat once, in the order its second booking arrives, as a list. If no seat is double-booked, print no double bookings.
Input
bookings, a list of (row, seat) tuplesPrintsa list of the double-booked seats, each once, in the order they are found; or
no double bookingsSame seatthe same row number and the same seat letter:
(12, "A") and (12, "B") are different seatsExamplesthe starter's bookings →
[(12, 'A'), (3, 'C')]; [(1, "A")] → no double bookingsExpected output1 line
- 1[(12, 'A'), (3, 'C')]