WeCodeAcademy

Formatting Output with f-strings

An f-string starts with f and inserts values in {}. You can also format numbers.

Examplepython
Open in editor »
Quick check

What does `f"{3.14159:.2f}"` give?

Your turn: write the code

Use an f-string to print Total: 13.50 from price and qty, with two decimals.

Finish the quick check (and any code exercise) to complete this lesson, or mark it done yourself.

Tip: use the left and right arrow keys to move between lessons.