Write a program that keeps names and email addresses in a dictionary as key-value pairs. The program should display a menu that lets the user look up a person’s email address, add a new name and email address, change an existing email address, and delete an existing name and email address. The program should save the data stored in a dictionary to a file when the user exits the program. Each time the program starts, it should retrieve the data from the file and store it in a dictionary. The program should include the following functions: a. A function to display a menu. b. A function to look up a person’s email address. c. A function to add a new name and email address. d. A function to change an email address. e. A function to delete a name and email address. f. A function to load emails from a file. g. A function to save emails in a file. h. Write main function with a loop that displays the menu allowing the user to select an operation from the menu; the program continue until the user enter 5. i. Validate all user input. Your program should check user input; for example, if the user wants to search or delete a name that does not exist in the dictionary, you should print something like the name is not in the database. If the user selects invalid operation from the menu, the program prints an error and allows the user to renter a valid operation; the program continue asking for a valid operation until a user selects a valid operation.
Write a
The program should display a menu that lets the user look up a person’s email address, add a
new name and email address, change an existing email address, and delete an existing name and
email address. The program should save the data stored in a dictionary to a file when the user
exits the program. Each time the program starts, it should retrieve the data from the file and store
it in a dictionary.
The program should include the following functions:
a. A function to display a menu.
b. A function to look up a person’s email address.
c. A function to add a new name and email address.
d. A function to change an email address.
e. A function to delete a name and email address.
f. A function to load emails from a file.
g. A function to save emails in a file.
h. Write main function with a loop that displays the menu allowing the user to select an
operation from the menu; the program continue until the user enter 5.
i. Validate all user input. Your program should check user input; for example, if the user
wants to search or delete a name that does not exist in the dictionary, you should print
something like the name is not in the
If the user selects invalid operation from the menu, the program prints an error and allows
the user to renter a valid operation; the program continue asking for a valid operation
until a user selects a valid operation.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps