A name lookup and a position lookup can fail for different reasons.
seats = {"A": ["Uma"]}
try:
print(seats["B"][0])
except KeyError:
print("Unknown section") # printed hereChanging B to A makes the first lookup succeed. An index past the last seat would then raise IndexError.
Implement locate_seat(sections, section, index). Each section maps to a list of names. Return the name at the supplied nonnegative, zero-based index. Return "unknown section" for a missing key and "no seat" for an index beyond the list.
locate_seat({"A": ["Uma"]}, "A", 2) # "no seat"