Element-wise Order Totals

Medium ⏱ 12 min 48% acceptance ★★★★★ 4.9
Write line_totals(quantities, unit_prices) multiplying parallel lists element-wise with a two-argument lambda passed to map (map accepts multiple iterables).

Examples

Example 1
Input
line_totals([2, 3], [10, 5])
Output
[20, 15]
Explanation

2×10 and 3×5.

Constraints

  • Use map with two iterables — no zip, no comprehension.
  • Return a list.

Topics

Lambda & Functionalmap multiple iterables

Companies

AmazonOracle

Hints

Hint 1

map(f, a, b) calls f(a[i], b[i]).

Hint 2

lambda q, p: q * p.

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