Exercise 3: Parse a Settings File and Report What Was Skipped — Possible Solution ==================================================================== lines = [ "# server settings", "host = example.com", "", "port = 8080", "debug true", " ", "# end of file", "mode = fast", ] settings = {} for number, line in enumerate(lines, start=1): line = line.strip() if not line or line.startswith("#"): continue if "=" not in line: print(f"line {number}: no '=' found, skipped") continue key, value = line.split("=", 1) settings[key.strip()] = value.strip() print(settings) Example run: line 5: no '=' found, skipped {'host': 'example.com', 'port': '8080', 'mode': 'fast'} WHY THIS WORKS AS AN ANSWER ------------------------------ Each guard clause removes one kind of line and moves on, leaving the last three lines to handle only the lines that passed every check. strip() first turns a line of spaces into an empty string, so 'not line' catches both blank lines and whitespace-only lines. split('=', 1) splits at the first equals sign only, so a value that contains = is kept whole, and strip() on both parts removes the spaces around the equals sign. enumerate(lines, start=1) gives human line numbers, so the report says line 5, not line 4.