dict.get retrieves a dictionary value without raising an exception when the key is absent. It returns None by default, or a caller-supplied default instead. section 4.4.3
Translate only mapped characters
A character-by-character translator can preserve unmapped characters with jumper.get(char, char): mapped digits change, while letters and punctuation remain unchanged. For example, '867-5309' becomes '243-0751'. section 4.4.3 section 4.2
Use dict.get when a lookup may miss:
- jumper.get('A') returns None instead of raising the KeyError produced by jumper['A']. section 4.4.3
- jumper.get('A', 'A') returns 'A', making the fallback explicit. section 4.4.3
- lookup.get(letter.upper(), f'I do not know "{letter}".') combines normalized keys with a user-facing fallback. section 7.3.4
>>> text = '867-5309' >>> [jumper.get(char, char) for char in text] ['2', '4', '3', '-', '0', '7', '5', '1']
Inspect each character's lookup result, including unchanged punctuation, before joining the results into a translated string. section 4.4.3




