Professional Documents
Culture Documents
AIM
WAP to store subscriber name and phone number in a dictionary and perform the
following operations as menu drive code using UDFs:
i) ADD
ii) VIEW iii)MODIFY NAME
iv)DELETE
v) EXIT
PROGRAM CODING:
def add(d):
name=input("enter the name:")
ph=int(input("enter the phone number:"))
d[ph]=name
def Delete(d):
dph=int(input("enter the phone number to be removed:"))
if dph in d:
d.pop(dph) #del d[dph]
else:
print("Phone number not present")
def modify(d,mph):
if mph in d:
n=input("Enter a new name")
d[mph]=n
else:
print("phone number not present")
def show(d):
print("current status of the dictionay:")
print(d)