CJCoding With Joseph
15free / daySign inCreate account

Add To The Cart

A cart menu keeps a running total. 1) Add price reads a price with the prompt Price: , converts it with float(), adds it to the total and prints Added.; 2) Show total prints Total: <total> with two decimals; 3) Quit prints Goodbye! and leaves the loop; anything else prints Unknown choice - try again.. Only the add branch is missing. Input: one line per choice or price, ending with 3. Prompts are part of the output, so after choice 1 the price prompt and the confirmation share a line with Choice: .

Expected Output:

1) Add price
2) Show total
3) Quit
Choice: Price: Added.
1) Add price
2) Show total
3) Quit
Choice: Price: Added.
1) Add price
2) Show total
3) Quit
Choice: Total: 6.50
1) Add price
2) Show total
3) Quit
Choice: Goodbye!

= newline. The output ends with a newline — print one after the last line.

Hints3 available
Topics:
Menus & Validation
📥 Auto-Input:
1\n2.50\n1\n4\n2\n3\n
This input is automatically fed to your program's stdin
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.