GST Invoice Calculator

Easy ⏱ 8 min 75% acceptance ★★★★★ 4.7
Write invoice_total(items) where each item is (name, price, qty, gst_pct). Return the grand total: sum of price × qty × (1 + gst_pct/100) per line, rounded to 2 decimals at the END (not per line — rounding order is a real billing bug).

Examples

Example 1
Input
invoice_total([('pen', 10, 3, 18), ('book', 250, 1, 5)])
Output
297.9
Explanation

35.4 + 262.5 = 297.9, rounded once.

Constraints

  • Round only the final total.
  • Empty invoice → 0.0.

Topics

Business Logicbilling

Companies

RazorpayZohoTally Solutions

Hints

Hint 1

Accumulate the exact values first.

Hint 2

round(total, 2) at the end.

Loading the Python runtime… Run executes your code and shows printed output; Submit checks your function against this problem's examples.