In the instructions: “Return {status: "OPEN", change: [...]}
, with the change due in coins and bills, sorted in highest to lowest order, as the value of the change
key.”
Test #2 illustrates that change
should only contain nonzero orders.
20 - 19.5 = [["QUARTER", 0.5]]
Test #3 illustrates that change
should be returned in descending order.
100 - 3.26 = [["TWENTY", 60], ["TEN", 20], ["FIVE", 15], ["ONE", 1], ["QUARTER", 0.5], ["DIME", 0.2], ["PENNY", 0.04]]
Based on the stated instructions and the previous examples, Test #6 should look like this, and this is what my code produces, which is correct.
20 - 19.5 = [["PENNY", 0.5]]
However, the stated expected result for Test #6 is in direct violation of the instructions and of Tests #2 and #3.
20 - 19.5 = [["PENNY", 0.5], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 0], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]]
Please explain. I’m pretty close to adding an if
clause at the beginning of my code for this specific case just to pass, since as far as I can tell this is a flaw in the test and my code is correct.