← Back to challenges

Shopping for Memorial Day!

PythonHardarraysobjects

Instructions

Create a function that takes a list of objects and calculate the total based on the quantity of items purchased. Apply a 6% sales tax for each item when appropriate.

Examples

checkout([
  { "desc": "potato chips", "prc": 2, "qty": 2, "taxable": false },
  { "desc": "soda", "prc": 3, "qty": 2, "taxable": false },
  { "desc": "paper plates", "prc": 5, "qty": 1, "taxable": true }
]) ➞ 15.3

Notes

N/A

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Divide a Fraction by Two