Flip the Score Map
In the old data format, the grouping is reversed: points come first, with a list of letters that share that value. The function transform receives legacy_data and converts it into a new dictionary where each key is a lowercase letter and each value is its score. The score keys arrive as strings, so convert them to integers before storing them.
Примеры
Ввод
{"1": ["A", "E", "I", "O", "U"]}Вывод
{"a": 1, "e": 1, "i": 1, "o": 1, "u": 1}Ввод
{"1": ["A"], "2": ["D"]}Вывод
{"a": 1, "d": 2}Ввод
{"4": ["F", "H"], "8": ["X"]}Вывод
{"f": 4, "h": 4, "x": 8}Нужно реализовать
def transform(legacy_data: dict) -> dict:
Теги
dicthashmap
Inicia sesión para ver tu historial de envíos
Iniciar sesiónInicia sesión para usar el AI Mentor
Iniciar sesiónTests7
Visible tests
Prueba oculta 7
They run when you press "Submit" — your whole solution is checked against them so you can't hard-code answers for the visible cases.
Focus radio
Paused · SomaFM · Fluid