Codington
0 of 6 problems solved • 0%

Exercise prompt

Repair the Caption Map

A guide uses short codes to find full captions. The starter builds the lookup in the wrong direction.

Example

A dictionary comprehension can compute a new value for every key.

words = ["reef", "cove"] lengths = {word: len(word) for word in words} print(lengths["reef"]) # 4

The expression before the colon becomes the lookup key. Identify what the guide will look up before deciding which field belongs there.

Your task

Repair caption_map(signs). Each pair contains a short code and a caption. Return a mapping from the uppercase code to the caption as written. If codes become equal after uppercasing, the later caption wins.