112. Python Program to Look Up a Phone Number
EasyRead values
Overview
A safe lookup: the program never stops with a KeyError, whatever the user types.
Problem Statement
The phone book is already in the starter code:
phone_book = {"Sunny": "98765", "Rocky": "91234", "Lucky": "99887"}
Read a name and print that person's number. If the name isn't a key in the phone book, print Not found. Names must match exactly, so sunny is not found. For example, for Rocky:
91234
Use input() with no prompt text: the tests type the input for you, and a prompt would end up in your output.
Input
One value per line, in this order. Example:
Rocky
Output
The output for that example:
91234
The tests try 4 different inputs.