Tell us what’s happening:
I would like you to review the last test case in the test module (in Replit.com) which was created for the Python - Budget App. I think the expected results created for this test case doesn’t seem to be right.
Your code so far
Your browser information:
User Agent is:
Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.54 Safari/537.36
Challenge: Budget App
Link to the challenge:
Could you explain why do you think test is not correct? If you have code that you think is right, but failing the said test, could you link to it too?
Thank you for replying. Before I send the code, just to clarify, does the string in the variable ‘expected’ of a test case hold the correct result?
As far as I’m aware, it does contain correct result.
I thought so. Then please confirm the result of the following. Trying to find the percentage spent on a category based on the withdrawals.
In the test case, the bar chart (percentage spent ) is to be created for food. The height of each bar should be rounded down to the nearest 10.
Based on the above stat, isn’t the value of the percentage spent 10.
No, it’s 100% - because it’s 100% of all listed withdrawals.
You are supposed to calculate the percentage of money spent per category compared to all money spent.
I’m sorry but I don’t agree that it’s 100%. Out of the 900 in deposit, only 105.55 has been withdrawn ( / spent). There is no other data available in the test case which shows any other withdrawal or money spent on that category. So the percentage spent obviously is 105.55 / 900 which would be 11. 7 % and then rounded to the nearest 10 gives 10%.
The test case shows it’s 70% and I don’t understand that?
It’s not 105.55 / 900. It’s withdraws in one category to total withdraws from all categories.
Now, I get it. Thank you for the feedback. Based on your explanation, withdrawal per category / total withdrawals (of all categories) is the basis of the results in the test case. To me, this scenario wasn’t very clear in the project requirement “The percentage spent should be calculated only with withdrawals and not with deposits”.
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.