← Back to User Input
Question 200
Restaurant Receipt
Restaurant Receipt
Ask for an item price with the prompt Price? , a quantity with Quantity? and a tip percentage with Tip percent? (each ending in a space; the price is a decimal number, the other two whole numbers). Then print a four-line receipt with two decimals on every amount using :0.2f: Subtotal: <price times quantity>, Tax: <13 percent of the subtotal>, Tip: <the tip percent of the subtotal> and Total: <subtotal plus tax plus tip>. Input: three lines in that order. The prompts are part of the output and input() stays on the same line, so the three prompts and the Subtotal line share the first output line, as shown in Expected Output.
Expected Output:
Price? Quantity? Tip percent? Subtotal: 25.00 Tax: 3.25 Tip: 5.00 Total: 33.25
= newline. The output ends with a newline — print one after the last line.
Hints4 available
Sign in to use hintsTopics:
User Input
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.