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.
Dictionaries and Maps
Dictionaries and Maps
Sort by
recency
|
48 Discussions
|
Please Login in order to post a comment
n=int(input()) phn_bk={} for i in range(n): entry=list(input().split(" ")) phn_bk.update({entry[0]:entry[1]}) while (1): try: qry=input() if qry in phn_bk: print(f"{qry}={phn_bk.get(qry)}") else: print("Not found") except (EOFError): break
Can anyone help me figure why all my test pass at submission yet I get a runtime error ? This is my code
Working Python Solution : n = int(input()) d = dict(input().split() for i in range(n)) while True: try: p = str(input()) if p not in d: print("Not found") else: print(p+"="+d[p]) except: break
USING UNORDERD MAPS:
include
using namespace std; int main(){ int n,i,num; cin>>n; string name;
}