Tell us what’s happening:
During this project we are doing all our code in the budget.py file. Here we have class definition (together with the diferent methods) and on the same “level” with the class we are proposed to create another function:
class Category:
def deposit(self, amount, description=""):
…
def create_spend_chart(categories):
…
Could you please help to understand if last function is related and is the part of class?
Because it little bit confusing me that on create_spend_chart call from
print(create_spend_chart([food, clothing, auto]))
I have received result which shows me data from class definition.
Please point me to helpful reading on this question.
Your code so far
def create_spend_chart(categories):
list_of_cat = categories
length = len(categories)
print(length, list_of_cat, list_of_cat[0])
and result of print(create_spend_chart([food, clothing, auto])) is:
3 [<budget.Category object at 0x7f1bb6d76a30>, <budget.Category object at 0x7f1bb6c803d0>, <budget.Category object at 0x7f1bb6c801c0>] Food
initial deposit 1000.00
groceries -10.15
restaurant and more foo -15.89
Transfer to Clothing -50.00
Total: 923.96
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36
.
Challenge: Budget App
Link to the challenge: