Hi everyone,
Similar issues observed on my end. My results are exactly same as @hannesWe’s.
Firstly, I think the description of the create_spend_chart problem is confusing:
The chart should show the percentage spent in each category passed in to the function. The percentage spent should be calculated only with withdrawals and not with deposits.
I’m pretty good with math, and I have never seen or read a percentage calculation described like that - especially when dealing with accounting. I had to work backwards from the unit tests’ bar chart and the cryptic “should be calculated only with withdrawals” to figure out that the task was to: calculate the amount spent in each category (i.e. each category’s total withdrawals) as a percentage of the sum total withdrawals from all the categories passed in to the function.
To make it clearer:
- the ‘food’ category had only 1 withdraw: 105.55
- the entertainment category had only 1 withdraw: 33.40
- the business category also had only 1 withdraw: 10.99
So ‘sum total withdrawals’ = 105.55+33.40+10.99 = 149.94
And each respective “percentage spent” would therefore be:
- ‘food’: (105.55 / 149.94) *100 = 70.39%
And you can work out the rest from there…
Which brings me to the second issue. This is the screenshot from the unit-tests results:
I am still new to coding but I believe it is saying that the percentage spent for Business should be 0% (i.e. there should ‘{space}’ and not ‘o’ at the level 10 bar). I think this is wrong but again I am happy to be corrected. The percentage spent for Business category can be easily calculated as 7.33% (as I described above), and this evaluates to 10% (“rounded to the nearest tenth”, as the instructions say). If I am correct, then the test module is incorrect on the last unit test - there should be ‘o’ at that level 10 bar.
I took the liberty of editing my test module’s last unit test to have a ‘o’ instead of the space and re-ran the file, and all tests passed. If there’s an admin-level forum member able to correct/confirm my observations, it’d be appreciated. Thanks!