1.

Write a user defined function findname(name) where name is an argument in Python to delete phone number from a dictionary phonebook on the basis of the name, where name is the key.

Answer»

def findname(name):

if phonebook.has_key():

del phonebook[name]

else:

print”Name not found”

print "Phonebook Information"

print "Name",'\t',"Phone number"

for i in phonebook.keys():

print i,'\t',phonebook[i]



Discussion

No Comment Found

Related InterviewSolutions