10 XP challenge
Total a Shopping Basket
easy
Build it yourself · 6 min
1 Learn2 Predict3 Solve
TaskYour mission
Return the total price of the basket: sum prices[index] * quantities[index] for every position. Both lists have the same length, 0 to 20. prices are integer cents from 0 to 1000; quantities are 0 to 20.
Examples
| Input | Return |
|---|---|
prices = [100,250], quantities = [2,3]total: 0 → 200 → 950. The result is 950. | 950 |
prices = [50,90], quantities = [0,2]total: 0 → 180. The result is 180. | 180 |
Your code
Write your answer inside Solution, then use return to send it back.
Ln 1, Col 1
JavaScript
Try examples runs the public examples. Check my code checks your full answer and saves your completion.