Python Course in 4 to 6 Weeks – Lesson 15: Mini Project – Contact Book App

📓 Python Course in 4 to 6 Weeks – Lesson 15: Mini Project – Contact Book App

Welcome to Lesson 15 of our Python Course in 4 to 6 Weeks. In this session, you will apply the skills you've learned to create a real mini project: a simple Contact Book App using Python.

🎯 Project Goal

Build a command-line contact book that can:

  • ➕ Add a contact
  • 📋 View all contacts
  • 🔍 Search for a contact
  • ❌ Delete a contact
  • 💾 Save and load contacts from a file

🛠️ Features Overview

  • Stores contacts in a dictionary
  • Persists data in a local text file (or JSON)
  • Handles user input with basic validation

💡 Example Code (Basic Version)

contacts = {}

def add_contact(name, phone):
    contacts[name] = phone
    print(f"Added: {name} – {phone}")

def show_contacts():
    for name, phone in contacts.items():
        print(f"{name}: {phone}")

def search_contact(name):
    if name in contacts:
        print(f"Found: {name} – {contacts[name]}")
    else:
        print("Contact not found.")

# Example usage
add_contact("Ali", "01012345678")
show_contacts()
search_contact("Ali")

📥 Tools You'll Need

⚠️ Optional Enhancements

  • Use json module to save/load contacts
  • Enable updating existing contacts
  • Create a looped CLI menu for actions
  • Handle exceptions properly

🧠 Challenge

Try to implement the full Contact Book CLI with menu options:

  • 1 - Add Contact
  • 2 - Show All
  • 3 - Search
  • 4 - Delete
  • 5 - Exit

🚀 Summary

By completing this mini project, you’re applying Python fundamentals in a practical way. Projects like this help you become confident and ready for real-world applications.

🔗 Coming Next:

Lesson 16: Real-World Python – Web, Data, Automation 🌍

Post a Comment