# File Handling Mini Project — Daily Notes
# append notes with timestamp, view all, never overwrite
# redhorndev.com

from datetime import datetime

FILENAME = "notes.txt"

while True:
    print("\n1 — Add note")
    print("2 — View all notes")
    print("3 — Quit")
    choice = input("Your choice: ")

    if choice == "1":
        note = input("Note: ")
        timestamp = datetime.now().strftime("%Y-%m-%d %H:%M")
        with open(FILENAME, "a", encoding="utf-8") as f:
            f.write(f"{timestamp} | {note}\n")
        print("Saved.")

    elif choice == "2":
        try:
            with open(FILENAME, "r", encoding="utf-8") as f:
                content = f.read()
            print("\n--- Notes ---")
            print(content)
        except FileNotFoundError:
            print("No notes yet.")

    elif choice == "3":
        print("Out.")
        break

    else:
        print("Invalid choice. Enter 1, 2, or 3.")
