My project name is Contact list using python code .In this code details are the person details are user given and taken give the output result contact success.
My project name is Contact list using Python code.the code details are given below:
First, we define a dictionary named contacts
to store our contact information. The keys of the dictionary will be the contact names, and the values will be dictionaries containing the phone number and email.
Next, we define three functions: add_contact()
, remove_contact()
, and search_contact()
.
The add_contact()
function prompts the user to input the name, phone number, and email of the contact. It then creates a dictionary with the contact information and adds it to the contacts
dictionary using the name as the key.
The remove_contact()
function prompts the user to input the name of the contact they want to remove. If the name exists in the contacts
dictionary, it removes the corresponding entry using the del
keyword.
The search_contact()
function prompts the user to input the name of the contact they want to search for. If the name exists in the contacts
dictionary, it retrieves and prints the contact details (phone number and email).
We then enter a while
loop that presents a menu to the user and executes the corresponding actions based on their input. The loop continues until the user chooses to exit the program.The menu options include adding a contact, removing a contact, searching for a contact, and exiting the program.
Inside the while
loop, we use conditional statements (if
, elif
, and else
) to execute the appropriate function based on the user's choice.
The program keeps looping through the menu until the user chooses to exit by entering "4". At that point, the program breaks out of the loop and displays a goodbye message.
You can run this code and interact with the menu to perform operations such as adding contacts, removing contacts, searching for contacts, and exiting the program.
after run this code to give the output CONTACT ADDED SUCCESSFULLY!
Submitted by S.Veera Dhana lakshmi (21ME1A5453)
Download packets of source code on Coders Packet
Comments