Skip to content

owen920831/nthu_python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

10 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ’Ύ Pymoney β€” A Simple Expense Tracker in Python

Pymoney is a command-line based personal finance tracker. It allows users to record incomes and expenses, classify them by category, and search or manage them through an intuitive CLI interface.


πŸ“† Features

  • πŸ“… Add multiple records at once: category description amount
  • πŸ“Š View all records and see running balance
  • πŸ—‘οΈ Delete records by index
  • πŸ—‚οΈ Display nested categories with indentation
  • πŸ”Ž Find records by category (supports subcategory matching)
  • πŸ“„ Persistent storage in records.txt
  • ✨ Recursion + yield / yield from to traverse nested lists

πŸͺ§ Project Structure

.
β”œβ”€β”€ 110062238_ζ½˜θŒ—θ„©_hw3.py      # Main interactive program
β”œβ”€β”€ test/
β”‚   └── test_hw3.py              # Unit tests with pytest
β”œβ”€β”€ records.txt                  # Persistent saved data (created at runtime)
└── README.md                    # This file

πŸš€ Getting Started

Run the program

python3 110062238_潘茜辝_hw3.py

Install dependencies for testing

pip install pytest

Run tests

pytest

πŸ“ File Format: records.txt

1000
meal breakfast -50
food bread -80
salary job 2000
  • Line 1: Initial balance
  • Remaining: Individual records (category, description, amount)

🫠 Concepts Demonstrated

  • β–‘ Object-Oriented Design

    • Record class for data
    • Categories for recursive category tree
    • Records for list management and file I/O
  • β–‘ Generator functions using yield, yield from

  • β–‘ Recursive traversal of nested lists

  • β–‘ CLI input/output and validation

  • β–‘ Data persistence with local files

  • β–‘ Unit testing with pytest


πŸ“– Sample Interaction

> What do you want to do (add / view / delete / find / exit)? add
Add some expense or income records:
meal breakfast -50, salary job 2000

> view
Index Category        Description          Amount
1     meal            breakfast            -50
2     salary          job                  2000
Now you have 1950 dollars.

> find
Which category? income
Category        Description          Amount
salary          job                  2000
The total amount above is 2000.

πŸ“™ License

MIT License Β© 2025 owen920831

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages