Tell us what’s happening:
I have problem with calculating the percentage and I don’t know where I could do a mistake. (I think the problem is maybe with rounding the number).
Your code so far
possible problem:
def get_categories_percent(categories):
lst_categ_percent = []
total_spent = sum([category.spent for category in categories])
for category in categories:
categ_percent = round(category.spent / total_spent, 1) * 100
lst_categ_percent.append(categ_percent)
return lst_categ_percent
rest of the code:
https://replit.com/@falconizmi/boilerplate-budget-app#budget.py
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.81 Safari/537.36
Challenge: Scientific Computing with Python Projects - Budget App
Link to the challenge: