Contact list using Python
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
contactsto 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(), andsearch_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 thecontactsdictionary 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 thecontactsdictionary, it removes the corresponding entry using thedelkeyword. -
The
search_contact()function prompts the user to input the name of the contact they want to search for. If the name exists in thecontactsdictionary, it retrieves and prints the contact details (phone number and email).
-
-
We then enter a
whileloop 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
whileloop, we use conditional statements (if,elif, andelse) 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!
-1687785535-1933.png)
Project Files
| .. | ||
| This directory is empty. | ||