Mini Project on Contact Book

Project Title: Contact Book

Project Description:

The Contact Book is a simple application designed to store and manage contact information. It allows users to add, view, edit, and delete contacts.

Features:

  1. Add Contact: Users can add a new contact with details such as name, phone number, email address, and any other relevant information.

  2. View Contacts: Users can view a list of all contacts stored in the contact book.

  3. Search Contacts: Users can search for a specific contact by name or any other criteria.

  4. Edit Contact: Users can edit the details of an existing contact.

  5. Delete Contact: Users can delete a contact from the contact book.

  6. Save Contacts: Contacts should be saved persistently so that they are available even after the application is closed and reopened.

Technologies:

  • Language: Python

  • Interface: Command-line interface (CLI)

  • Data Storage: Text file (for simplicity)

Implementation:

  1. Setup:

    • Create a Python script file for the Contact Book.

    • Create a text file to store contact information (e.g., contacts.txt).

  2. Main Menu:

    • Display options for Add, View, Search, Edit, and Delete contacts.

    • Prompt the user to choose an option and execute the corresponding functionality.

  3. Add Contact:

    • Prompt the user to input contact details (name, phone number, email, etc.).

    • Append the contact information to the text file.

  4. View Contacts:

    • Read the contents of the text file and display them in a formatted manner.
  5. Search Contacts:

    • Prompt the user to enter a search query (e.g., name).

    • Display contacts matching the search query.

  6. Edit Contact:

    • Prompt the user to enter the name of the contact to be edited.

    • Display the contact details and allow the user to modify them.

    • Update the corresponding entry in the text file.

  7. Delete Contact:

    • Prompt the user to enter the name of the contact to be deleted.

    • Remove the corresponding entry from the text file.

  8. Save Contacts:

    • Ensure that any changes made to contacts are saved back to the text file.
  9. Error Handling:

    • Implement error handling for invalid inputs and file operations.

Example Code Snippet (Add Contact):

def add_contact():
    name = input("Enter name: ")
    phone = input("Enter phone number: ")
    email = input("Enter email address: ")

    with open("contacts.txt", "a") as file:
        file.write(f"{name},{phone},{email}\n")
    print("Contact added successfully!")

Additional Features (Optional):

  • Sorting: Allow sorting contacts by name or other criteria.

  • Import/Export: Support importing and exporting contacts from/to CSV or other formats.

  • Multiple Address Books: Allow users to maintain multiple contact books (e.g., personal, work).

  • GUI Interface: Develop a graphical user interface (GUI) using libraries like Tkinter.

Conclusion:

The Contact Book project provides a basic yet functional application for managing contact information. It can be extended with additional features and improvements based on user requirements and feedback.

Watch Now:-https://www.youtube.com/watch?v=4sEfkbqDWJM&t=68s