You are viewing a single comment's thread. Return to all comments →
n = int(input()) phonebook = {}
for i in range(n): name, phone = input().split() phonebook.update({name: phone})
while True: try: query = input() if query in phonebook: print(query +'='+ phonebook[query]) else: print('Not found') except EOFError: break
Seems like cookies are disabled on this browser, please enable them to open this website
Day 8: Dictionaries and Maps
You are viewing a single comment's thread. Return to all comments →
Enter your code here. Read input from STDIN. Print output to STDOUT
n = int(input()) phonebook = {}
for i in range(n): name, phone = input().split() phonebook.update({name: phone})
while True: try: query = input() if query in phonebook: print(query +'='+ phonebook[query]) else: print('Not found') except EOFError: break