Exercise 6: A Neater Record — Possible Solution ==================================================================== profile = { "username": "mkhan", "level": 7, "score": 1520.5, "active": True, "badges": ["early", "helper", "streak"], "coords": (55.95, -3.19), "prefs": {"theme": "dark", "alerts": False}, } for key, value in profile.items(): if isinstance(value, list): print(f"{key:<10}: {', '.join(map(str, value))}") elif isinstance(value, tuple): print(f"{key:<10}: {' / '.join(map(str, value))}") elif isinstance(value, dict): print(f"{key:<10}:") for inner_key, inner_value in value.items(): print(f" {inner_key:<8}= {inner_value}") else: print(f"{key:<10}: {value}") Output: username : mkhan level : 7 score : 1520.5 active : True badges : early, helper, streak coords : 55.95 / -3.19 prefs : theme = dark alerts = False WHY THIS WORKS AS AN ANSWER ------------------------------ The shape is the same as the snippet: .items(), an isinstance chain, a nested loop for the dict. The differences are the fixes. coords holds floats, so its items go through map(str, ...) before join (without that, TypeError). The else branch no longer wraps the value in quotes, so 7 and True print as themselves. And {key:<10} pads every key to the same width, which is what lines the values up in a column. Dropping the quotes does mean a string value and a number now look alike, which is fine for display but is why repr exists.