You are viewing a single comment's thread. Return to all comments →
n = int(input())
phone_book = {}
for _ in range(n): entry = input().split() name = entry[0] phone_number = entry[1] phone_book[name] = phone_number
try: while True: query = input().strip() if query in phone_book: print(f"{query}={phone_book[query]}") else: print("Not found") except EOFError: pass
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 →
n = int(input())
phone_book = {}
for _ in range(n): entry = input().split() name = entry[0] phone_number = entry[1] phone_book[name] = phone_number
try: while True: query = input().strip() if query in phone_book: print(f"{query}={phone_book[query]}") else: print("Not found") except EOFError: pass