Command Palette

Search for a command to run...

Hectal
Phase 1: Values, Variables and Types
Python · Exercise 5 of 6 PreviousNext
Beginner

Print a tidy receipt line

Set total to price times qty. Then print one line with an f-string: the item name left-aligned in 10 characters, followed by the total right-aligned in 8 characters with 2 decimals.

For Notebook, 45.5 and 3, the line is Notebook 136.50 (four spaces sit between the name and the number: two from the name padding, two from the number padding).

What Check tests

  1. total is 136.5
  2. The program prints exactly one line
  3. The line is Notebook 136.50

Stuck? One hint at a time

The solution unlocks after your first Check. Try first: that is where the learning happens.

main.py
Sign in to run your code.

Output

Press Run to see what your program prints.