Count and total · Medium

Add up a bill

Each line of a bill is "<item> x<quantity> @ $<price>".

Task

Write a prompt that gives the total.

Output format

$<total with 2 decimals>

Your prompt must contain {input}: it is replaced by each test case, just like the hidden tests in a hiring test.

Sample case 1
Input
Coffee x2 @ $3.50
Cake x1 @ $4
Output
$11.00
Sample case 2
Input
Pen x10 @ $0.99
Output
$9.90

There are 4 test cases in all; the others are like hidden tests: work out what tricky inputs they might use!

Loading the editor…