Last active
March 30, 2018 11:49
-
-
Save Nditah/5a69bd154344980debcba9410c5fefa9 to your computer and use it in GitHub Desktop.
Phone Contact List with Dictionary in Python3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/python3 | |
import sys | |
if __name__ == '__main__': | |
n = int(input()) | |
m = 1 | |
i=0 | |
dic = {} | |
for i in range (n): | |
S = str(input()).split(" ") | |
name = S[0] | |
phone = S[1] | |
dic[name] = phone | |
#print(str(dic)) | |
m += 1 | |
#print(str(i)+" " + name +" = " + phone) | |
#print(m) | |
while(m > n): | |
try: | |
someone = str(input()) | |
except EOFError: | |
break | |
if(someone): | |
#print(dic) | |
if (someone in dic): | |
print(someone + "=" + dic[someone]) | |
else: | |
print("Not found") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment