Exercise 1: An Unlisted Character Falls Back Correctly — Possible Solution ==================================================================== THE TEST ------------------------------ char_width_px('#', 16.0) RESULT ------------------------------ 8.0 '#' has no entry anywhere in CHAR_WIDTHS_EM, and no error is raised. WHY THE FALLBACK WORKS ------------------------------ char_width_px's own single line is: em = CHAR_WIDTHS_EM.get(ch, DEFAULT_CHAR_WIDTH_EM) return em * font_size_px dict.get(key, default) returns the dict's own value for that key if it exists, and the supplied default otherwise -- it never raises KeyError the way CHAR_WIDTHS_EM['#'] would. Since '#' isn't one of the letters, digits, punctuation marks, or the space character explicitly listed in CHAR_WIDTHS_EM, em resolves to DEFAULT_CHAR_WIDTH_EM, which is defined as 0.50. THE EXACT PIXEL VALUE ------------------------------ em = 0.50 font_size_px = 16.0 result = 0.50 * 16.0 = 8.0 WHY THIS WORKS AS AN ANSWER ------------------------------ This confirms the width table is deliberately incomplete by design, not by oversight -- real font-metric tables in real browsers cover a similarly bounded set of common characters and fall back to a reasonable average for anything outside it (a real font still HAS to render an unusual glyph, and still needs SOME width to reserve for it during layout, even without a hand-tuned measurement). Using .get() with an explicit default is what makes this graceful rather than a crash -- exactly the kind of defensive lookup that lets a simplified, hand-built table like this one stay usable against arbitrary real-world text without needing to enumerate every possible character in advance.