Scientific Computing with Python Projects - Budget App

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
    return lst_categ_percent

rest of the code:

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:

Are you sure about using round?

The height of each bar should be rounded DOWN to the nearest 10.

Thank you, I miss read one word.

1 Like