You are viewing a single comment's thread. Return to all comments →
This is python solution can any one fix the error it failed test case1 n= int(input()) phonebook = {} for i in range(n):
entry = input().split() name = entry[0] phone = entry [1] phonebook[name] = phone
queries = []
for i in range(n): query = input() queries.append(query)
for query in queries: if query in phonebook: print(f"{query}={phonebook[query]}")
else: print("Not found")
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 →
This is python solution can any one fix the error it failed test case1 n= int(input()) phonebook = {} for i in range(n):
queries = []
for i in range(n): query = input() queries.append(query)
for query in queries: if query in phonebook: print(f"{query}={phonebook[query]}")