EasyBasicsNot started

Market basket total

A weekend market records three item lines. Each line contains a decimal unit price followed by an integer quantity. Calculate the complete basket value and print it with exactly two digits after the decimal point.

Input

Three lines, each containing a price and quantity separated by one space.

Output

One line: the basket total formatted to two decimal places.

Example 1

Input

2.50 2
1.25 3
4.00 1

Output

12.75

5.00 + 3.75 + 4.00 gives 12.75.

Constraints

  • 0.01 <= price <= 1000
  • 1 <= quantity <= 100

Hints

Hint 1 of 3

Split each line into two strings.

Hint 2 of 3

Convert the price with float and quantity with int.

Hint 3 of 3

Add price * quantity inside the loop, then use :.2f when printing.

Solution

Show a reference solution and explanation
 Python · reference solution
total = 0.0
for _ in range(3):
    price, quantity = input().split()
    total += float(price) * int(quantity)
print(f"{total:.2f}")

Why it works

The loop handles every item line in the same way. Converting the two fields to their numeric types makes multiplication meaningful, while the format specifier controls how the final value is displayed.

Lesson for this exercise: Operators in Python

Your program
total = 0.0
for _ in range(3):
    price, quantity = input().split()
    # add this line's value to total
print(f"{total:.2f}")

Tests: 3 cases including the examples. Passing every test marks the exercise solved in this browser.

How this page was checked. Every program on it was run with CPython 3.11 at build time; runs in your browser on CPython 3.14 (Pyodide) by the publishing checks, and the output shown is what it printed. The Run buttons execute the same code on your device; nothing you type is sent anywhere.