Names and values · routine
A receipt line
Read an item name, a price and a quantity (one per line) and print one receipt line: 3 x apple = 1.50 — the total always with two decimals.
An f-string does the formatting: f"{total:.2f}" writes a number with exactly two digits after the point.
- right answers
Stuck on the idea rather than the code? The Types, and printing them nicely lesson walks through it.