Budget app tracking moving of objects

Hello,

So i had some difficulties with the creation of the class Category.

First i tried to work with nested dictionnaries but then i realised it didn’t do what i wanted. I didn’t understand how i could filter out the “name of the category” to show the different info of categories. I even tried to make new list names to make it workable.

ledger {"name category": {description: amount}}

'''  Creating lists
        for i in range(1,6):
            globals()["my_list_"+str(i)] = []
            for j in range(10):
            globals()["my_list_"+str(i)].append(j)'''

So i watched some more video’s about classes and i understood i was completely wrong about how i could solve it.

Anyway, now i have a pritty workable (not yet done tho) code. I understand that every Category i make, i am creating an “object” (i think).

food = budget.Category("Food")
food.deposit(1000, "initial deposit")
food.withdraw(10.15, "groceries")
food.withdraw(15.89, "restaurant and more food for dessert")
print(food.get_balance())
clothing = budget.Category("Clothing")
food.transfer(50, clothing)

i even think i understand why the object clothing has to be made first before transferring money to it.

Now i am trying to see if its possible to see what the objects are doing behind the scene? I there a way to track those object and understand whats in it?

Thanks
Joris

Adding print-statements into the code is the quickest and easiest way to get insights into what they are doing.
If you remember to remove them later, you could also add them in the test module file.

That said, there shouldn’t be to much confusion as to what the categories do behind the scenes. In part because you are the one writing the code thus you should know what they are doing. Plus those aren’t all to complicated calls.

If you struggle you might want to consider posting a link to your replit so we can take a more indepth look at your code.

Thanks for the info.
I indeed work alot with print() to look what it does.

This is where i am. I had a problem with the transfer info but now it is fixed.
boilerplate-budget-app - Replit

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.