We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
numOfEntries=int(input())#GettingnumberofentriesforphonebookphoneBook={}#dictionaryforentryforiinrange(0,numOfEntries):entry=input();name=entry.split()[0];number=int(entry.split()[1])# Insert into phone book with name as keyphoneBook[name]=numberquery=input()#firstquerywhile(True):ifqueryinphoneBook:output=query.strip()+"="+str(phoneBook[query])print(output)else:print("Not found")try:#Checksforendofinputquery=input()except:break
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Dictionaries and Maps
You are viewing a single comment's thread. Return to all comments →
Nice and simple python code :)