← Back to Dictionaries
Question 273
Contact Book From Input
Contact Book From Input
Build a contact book from the input, then answer one lookup. Input: the first line is a whole number n; then n pairs of lines follow, a name line and then that person's number line; the final line is a name to look up. Read everything with a bare input(), no prompts, using range(n) for the pairs. Store each pair in a dict with the name as the key. For the lookup use in to check the key first: print the number if the name was added, otherwise print <name> not found. Output: one line.
Expected Output:
555-0199= newline. The output ends with a newline — print one after the last line.
Hints4 available
Sign in to use hintsTopics:
Dictionaries
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.