Scientific Computing with Python Projects - Budget App

I am failing a single test, which is

FAIL: test_create_spend_chart

Here are the details :

AssertionError:
'Perc[170 chars] 10| o o o \n 0| o o o \n ----------[204 chars] t ’ != 'Perc[170 chars] 10| o o \n 0| o o o \n ----------[204 chars] t ’

From the above output, I figured out that my chart is showing an extra “o” for the first category, which makes it 10 per cent of all. But the expected output is 0 per cent.

According to the test, there are three budget categories business, food, and entertainment, with 10.99, 105.55 and 33.40, respectively, as withdrawals.

The calculated percentage, as calculated by the first line of code below of these three, are
[7, 70, 22], which is rounded to [10, 70, 20] by the second line.

10 + 70 + 20 adds up to 100.
but 0 + 70 + 20 adds up to 90 only.

And in the challenge description, it was mentioned that,
"The height of each bar should be rounded down to the nearest 10. "

I know am wrong, and I didn’t understand the meaning of the above line.
how can I round 7 to 0, and is it correct to do so?

Your code so far

percentage = [round(amount*100/total) for amount in withdrawsAmount]
percentage = [round(p, -1) for p in percentage]

Your browser information:

User Agent is: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/109.0

Challenge: Scientific Computing with Python Projects - Budget App

Link to the challenge:

Per the specification, bars should be rounded down to the nearest 10.

Thanks for replying! But I’m confused about what should be the nearest ten of 7, 10 or 0. And suppose if it is 29, then it should be 20 or 30.

Round it down :slight_smile:, so 70, 1010, 2920.

Thanks again for replying! I got it now.