def total(lines): subtotal = 0.0 for price, qty in lines: subtotal += price * qty tax = subtotal * 0.0825 return round(subtotal + tax, 2) def refund(amount): return -abs(float(str(amount)))