DICTIONARY (INPUT FROM USER), EOF ERROR(TRY AND EXCEPT)



 




inp=int(input())
phonebook={}
for i in range(inp):
    user=input()
    temp=user.split()
    phonebook[temp[0]]=temp[1]
keys=[]
try:
    while True:
        key=input()
        keys.append(key)
except EOFError:
    pass
l=len(keys)
for j in range(l):
    if keys[j] not in phonebook:
        print("Not found")
    else:
        print(keys[j],end="")
        print("=",end="")
        print(phonebook[keys[j]])
    



Comments

  1. Why don't you use comments and also while taking input just put some phrases to make your code more understandable a
    For people like me 😎💟😁

    ReplyDelete

Post a Comment

Popular posts from this blog

LOOP, STRING, LIST, CONDITION

CLASS AND OBJECT

LIST INPUT FROM USER