Skip to content

Instantly share code, notes, and snippets.

@Nditah
Last active March 30, 2018 11:49
Show Gist options
  • Save Nditah/5a69bd154344980debcba9410c5fefa9 to your computer and use it in GitHub Desktop.
Save Nditah/5a69bd154344980debcba9410c5fefa9 to your computer and use it in GitHub Desktop.
Phone Contact List with Dictionary in Python3
#!/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