https://github.com/gappeah/budget_app
As part of my five projects for freeCodeCamp Scientific Computing with Python. I created the budget app that accounts for depositing, withdrawing, getting the balance, transferring, and checking funds. The class also prints the percentage for each item class
https://github.com/gappeah/budget_app
Last synced: over 1 year ago
JSON representation
As part of my five projects for freeCodeCamp Scientific Computing with Python. I created the budget app that accounts for depositing, withdrawing, getting the balance, transferring, and checking funds. The class also prints the percentage for each item class
- Host: GitHub
- URL: https://github.com/gappeah/budget_app
- Owner: gappeah
- Created: 2023-08-29T15:18:16.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-08-29T15:24:13.000Z (almost 3 years ago)
- Last Synced: 2025-01-07T19:44:39.998Z (over 1 year ago)
- Language: Python
- Homepage:
- Size: 5.86 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
I completed the Category class in budget.py according to the instructions. The class can instantiate objects based on different budget categories, and it has methods for depositing, withdrawing, getting the balance, transferring, and checking funds. The class also prints the budget object in a formatted way.
I also created a function called create_spend_chart that takes a list of categories as an argument. The function returns a string that is a bar chart showing the percentage spent in each category. The percentage spent is calculated only with withdrawals and not with deposits. The bar chart has labels 0 - 100 on the left side, and the bars are made out of the "o" character. The height of each bar is rounded down to the nearest 10. The horizontal line below the bars goes two spaces past the final bar. Each category name is written vertically below the bar. The function is tested with up to four categories.
Here is an example of the output of the create_spend_chart function:
```
Percentage spent by category
100|
90|
80|
70|
60| o
50| o
40| o
30| o
20| o o
10| o o o
0| o o o
----------
F C A
o l u
o o t
d t o
h
i
n
g
```
I wrote my code in budget.py. For development, I used main.py to test my Category class. I clicked the "run" button and main.py ran. The tests from test_module.py were imported to main.py for my convenience. The tests ran automatically whenever I hit the "run" button.