Codington
0 of 6 problems solved • 0%

Exercise prompt

Repair the Seat Map

The booking desk needs a lookup from seat number to passenger. The starter has these roles reversed.

Example

Decide which side of a dictionary entry supplies a lookup.

locker_owners = {14: "Alma"} print(locker_owners[14]) # Alma locker_owners[14] = "Bo" print(locker_owners) # {14: 'Bo'}

The locker number is the key used by the desk. A new assignment at the same key replaces its previous value.

Your task

Repair seat_map(bookings). Each pair contains a passenger name followed by a seat number. Return a dictionary keyed by seat number. If another passenger books the same seat, keep the later passenger.