Dictionaries · 6 / 15 Exercise Easy

Contact book

Objective

Create a Python program that stores contacts in a dictionary and looks up the phone number of one of them.

Instructions

  • Read an integer n and then the data of n contacts: for each one, their name on one line and their phone number on the next.
  • Store them in a dictionary with the name as the key and the phone number as the value. If a name is repeated, keep the last phone number.
  • Read the name to look for.
  • Show their phone number, or Not found if that name is not in the book.
Input
3
ana
600111222
luis
600333444
eva
600555666
luis
Output
600333444

Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.

Start exercise