Phone Book
Completed
The phone book is {"ann": "555-1234", "bob": "555-9876", "cy": "555-0000"}. Read a name and print the number, or not found.
Input
One name.
Output
A number or not found.
Example
Input
bob
Output
555-9876
Editor
Python
Hints
dict.get(key, default) returns default when the key is missing.
Solution explanation
book[key] raises KeyError for a missing key; get doesn't.
Show solution
book = {"ann": "555-1234", "bob": "555-9876", "cy": "555-0000"}
print(book.get(input(), "not found"))