Write a program to input your friends names and their Phone Numbers and store them in the dictionary as the key-value pair. Perform the following operations on the dictionary:
a) Display the name and phone number of all your friends
b) Add a new key-value pair in this dictionary and display the modified dictionary
c) Delete a particular friend from the dictionary
d) Modify the phone number of an existing friend
e) Check if a friend is present in the dictionary or not
f) Display the dictionary in sorted order of names
n = int(input("Enter how many names you want to enter: "))
# initialize empty dictionary
names={}
for i in range(n):
name=input("Enter name of friend: ")
number=input("Enter phone number: ")
names[name]=number #add name number to dictionary
print(names)
names["Arun"]="9877666234" #add new item
print("Modified dictionary ",names)
del names["Arun"] #delete an item
for name in names: #modify first key value
names[name] = "9456356344"
break
print("Amit" in names)
print("dictionary in sorted order")
for i in sorted (names) : #sort the dictionary
print((i, names[i]), end =" ")