Scientific Computing with Python Budget App Error

The test_create_spend_chart test is wrong. It has 70% for food, the actual percantage is 33.98% rounded down to 30%.

can you please give more details?

Budget App The expected value for the test_create_spend_chart test in test_module.py is wrong.

I suspect that you are reading the test output incorrectly. With a valid solution code, the test suite passes fine for me.

read the markdown again, saw my mistake, passed the test
thanks,
Mark

I’m still not seeing the mistake as I think I have the same issue. The testing module gives the criteria:

self.food.deposit(900, “deposit”)
self.entertainment.deposit(900, “deposit”)
self.business.deposit(900, “deposit”)
self.food.withdraw(105.55)
self.entertainment.withdraw(33.40)
self.business.withdraw(10.99)

This would result in all the answers for percentage being rounded down to 30%. Am I getting my basic math wrong somehow or severely misinterpreting what the results should be?

Food deposits 900, then withdrawals 105.55, leaving 794.45.
Entertainment deposits 900 then withdrawals 33.4, leaving 866.6.
Business deposits 900 then withdrawals 10.99, leaving 889.01.

The total remaining funds in each category add up to 2550.06.

This means:
food would be 31.15%
entertainment would be 33.98%
and business would be 34.86%.

Rounded down to the nearest 10 means they are all 30%.

This is the answer I get from my programing code, but the testing code has percentages of food: 70%
entertainment: 20%
business: 0%

It’s not a formatting problem since if I change the testing answers to represent 30% for all categories it passes.

For anyone having the same issues I did:

I finally figured out the issue after reading more posts.

The spend chart function isn’t looking for a % of each of the categories compared to the total of all remaining funds.

It is supposed to calculate the % of the funds withdrawn compared to all withdrawn funds.

Total funds withdrawn is 105.55 + 33.4 + 10.99 = 149.94
105.55 → 70.39%, 33.4 → 22.28%, 10.99 → 7.33%

So test answers are correct, just tricky wording on what the function is supposed to calculate.