DEV Community

Priti Yadav
Priti Yadav

Posted on

Smart Diary: A Python-Based Task & Reminder Scheduler for My Friend

Hey everyone! 👋

For this week's Hacktoberfest Weekend Challenge ("Build for a Friend"), I wanted to solve a very practical real-world problem for my roommate/friend who often forgets daily tasks and reminders.

To help them stay organized without getting overwhelmed by boring, complex apps, I built a lightweight, friendly command-line task scheduler in Python called Smart Diary.

What it does:

  • Friendly Assistant Tone: Gives a supportive response when a task is noted down.
  • Persistent Storage: Automatically saves tasks with timestamps into a local text file (tasks.txt).
  • Interactive Menu: Allows users to easily add new tasks or view their saved history anytime.

The Code (smart_diary.py):


python
import datetime

def show_tasks():
    print("\n--- Your Saved Tasks ---")
    try:
        with open("tasks.txt", "r") as file:
            tasks = file.read()
            if tasks.strip() == "":
                print("No tasks saved yet!")
            else:
                print(tasks)
    except FileNotFoundError:
        print("No tasks diary found yet.")
    print("-" * 25)

def add_task():
    print("--- Smart Reminder Diary for a Friend ---")
    task_desc = input("What is the task/reminder? (e.g., Submit assignment by tomorrow): ")

    with open("tasks.txt", "a") as file:
        file.write(f"- {task_desc} (Added on: {datetime.datetime.now().strftime('%Y-%m-%d %H:%M')})\n")

    print(f"\n[AI Friend]: Got it! I've noted down: '{task_desc}' and saved it to your diary.")
    print("[AI Friend]: Don't worry, I'll remind your friend right on time so they never miss it!")

if __name__ == "__main__":
    while True:
        print("\n1. Add a Task")
        print("2. View Saved Tasks")
        print("3. Exit")
        choice = input("Choose an option (1/2/3): ")

        if choice == '1':
            add_task()
        elif choice == '2':
            show_tasks()
        elif choice == '3':
            print("Goodbye! Take care of your friend!")
            break
        else:
            print("Invalid choice, please try again.")
Enter fullscreen mode Exit fullscreen mode

Top comments (0)