BaseCodeByte
Back to Python course
PyValues and TypesBeginnerLive Python10 min

Numbers

Calculate totals with integers, floats and round().

Explanation cell

Python can work with whole numbers and decimal numbers. You can use it for calculations, totals, percentages and simple automation tasks.

integersfloatsarithmeticround()

Quick tip

Run small edits often. Tiny feedback loops make Python easier to learn.

Common mistake

Numbers used for math should not be wrapped in quotation marks.

Code cell

Starter code · Ctrl+Enter runs · Ctrl+Shift+Enter tests

Python runtime loads on first run

Output cell

Run your code to see output.

Run your code to see output.

Test cell

Tests run against the actual Python output.

Run tests to check your code against the lesson goals.

Practice cell

Try this

Change the price and calculate a new total.

Expected output

24.19