← Back to Menus & Validation
Question 460
Running Subtotal
Running Subtotal
Read prices one per line with the prompt Price: until a blank line. After each price, convert it with float(), add it to the total and print Subtotal: <total> with two decimals; after the blank line print Total: <total> the same way. Input: zero or more prices, then an empty line. Prompts are part of the output, so each subtotal follows a prompt on the same line.
Expected Output:
Price: Subtotal: 2.50 Price: Subtotal: 3.75 Price: Total: 3.75
= newline. The output ends with a newline — print one after the last line.
Hints2 available
Sign in to use hintsTopics:
Menus & Validation
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.