python intermediate 2026-11-17 को समाप्त

Flatten nested settings

Config files are often nested. Write flatten(d) that turns nested dicts into one level, joining keys with dots:

flatten({"db": {"host": "x", "port": 5432}, "debug": True})
# {"db.host": "x", "db.port": 5432, "debug": True}
  • Only dicts are flattened; lists and other values are kept as they are.
  • An empty nested dict disappears.

अब तक 0 लोगों ने हल किया।

python
एडिटरCtrl + Enter

            
        

जब टेस्ट "All tests passed" दिखाते हैं, तो चैलेंज इस ब्राउज़र में हल के रूप में चिह्नित हो जाता है।

अपना समाधान समीक्षा के लिए भेजें