Command Palette

Search for a command to run...

Hectal
Phase 3: Strings and Text in Depth
Python · Exercise 4 of 6 PreviousNext
Beginner

Print a neat price row

You have name = "Asha", price = 1234.5 and qty = 3. Print one line with an f-string, laid out as three parts separated by |:

the name left-aligned in 8 characters, the price right-aligned in 10 characters with a thousands separator and two decimals, and x followed by the quantity. The line must be exactly Asha | 1,234.50|x3.

What Check tests

  1. The printed line is Asha | 1,234.50|x3
  2. The program prints exactly one line
  3. The row is built with an f-string
  4. name, price and qty are unchanged

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.