DEV Community

San Kang
San Kang

Posted on • Edited on

πŸ“‡ Python Mini Project #1 - Personal Contact Manager (ver 1.0)

🧠 Why I Made This

As part of my Python learning journey, I decided to build a practical mini project to apply the concepts I've learned so far β€” like lists, dictionaries, loops, and conditionals.

This Personal Contact Manager was built after completing the Python Intermediate course.


πŸ’‘ Project Description

This is a simple terminal-based contact manager that allows the user to:

  • Add new contacts
  • Search for a contact by name
  • Delete contacts
  • View all saved contacts

Each contact is stored as a dictionary with "name" and "number" keys inside a list.


πŸ§ͺ Features Implemented

  • Menu-driven interface using while True
  • Data stored in memory using a list of dictionaries
  • Search and delete using for-else pattern
  • Graceful handling of edge cases (like empty contact list)

🧾 Code - Version 1.0

contacts = []

def show_menu():
    print("\n=====Contacts Manager ver 1.0=====")
    print("1. Add contact")
    print("2. Search contact")
    print("3. Delete contact")
    print("4. View all contacts")
    print("5. Exit")

while True:  #TODO
    show_menu()
    choice = input("Choose an option (1-5) : ")

    if choice == "1":
        name = input("Enter a name : ")
        number = input("Enter a number : ")
        contact = ({"name": name, "number": number})  #OOPS
        contacts.append(contact)
        print(f"{contact} has been added!")

    elif choice == "2":
        if len(contacts) < 1:
            print("No contacts available")
        else:
            name = input("Enter a name to search : ")  #Try 'for-else'
            for contact in contacts:  #OOPS
                if contact['name'] == name:
                    print(f"{contact}")  #BUG
                    break
            else:
                print("Incorrect name!")

    elif choice == "3":
        if len(contacts) < 1:
            print("There are no contacts to show")
        else:
            name = input("Enter a name to delete : ")
            for contact in contacts:
                if contact['name'] == name:  #TODO
                    choice_d = input("Do you really want to delete?[y/n] : ")
                    if choice_d == "y":
                        print(f"{contact} has been deleted!")  #BUG
                        contacts.remove(contact)  #BUG
                        break
                    elif choice_d == "n":
                        break
                    else:
                        print("Incorrect choice")
                        break
            else:
                print("Incorrect name")

    elif choice == "4":
        if len(contacts) < 1:
            print("There are no contacts to show")
        else:
            for contact in contacts:
                print(f"{contact}")

    elif choice == "5":
        print("Goodbye!")
        break
Enter fullscreen mode Exit fullscreen mode

βœ… AI Feedback (ver 1.0 Review)

Category Evaluation
Feature Completeness ⭐⭐⭐⭐⭐
Code Structure β­β­β­β­β˜† (function modularization possible)
Self-Annotation ⭐⭐⭐⭐⭐ (excellent use of #OOPS, #BUG)
UX Consideration β­β­β­β­β˜† (friendly but could improve formatting)
Suggestions Improve output format, handle invalid inputs, move to OOP or file I/O next

Quote from my AI mentor:

"This is exactly how a real programmer grows β€” make it work, then make it better."


πŸ”œ What’s Next? (Version 1.1 Preview)

  • Format the output to be more user-friendly (e.g., Name:, Number:)
  • Add input validation (isdigit(), strip())
  • Save/load contacts using file I/O
  • Optionally refactor to a Class-based (OOP) version

βœ… Summary

This is my first Python mini project, and I learned a lot by actually building something!

I'm excited to improve this further and apply feedback step-by-step in upcoming versions.


πŸ’¬ Feedback Welcome!

If you have ideas or suggestions, I'd love to hear them.

Stay tuned for ver 1.1 soon!


πŸ†• Update: ver 1.1 Completed!

Version 1.1 brings improvements like:

  • Input validation for name and phone number
  • Readable output format: Name: XXX, Number: YYY
  • Case-insensitive search and delete
  • Simplified condition checks using if not contacts

We decided to leave the menu handler refactoring (e.g., using functions or dictionary mapping for choices)

as a planned enhancement for Mini Project 2,

to keep this version focused and beginner-friendly.


πŸ”— View Full Code

You can view the full refactored version (ver 1.1) here:

πŸ‘‰ GitHub: contact_manager_v1.1.py

Top comments (0)