Skip to content

Python

Numeric expressions

Arithmetic operators combine numbers into expressions, such as a total price.

Maya's receipt shows three items at $4 each and one $2 fee. She wants Python to work out the whole charge in a single line. How can one calculation get it right?

Start the lesson

5 minutes. No sign-up needed.

What you'll learn5 ideas
  • A numeric expression is a calculation written with numbers, like 3 * 4, which Python turns into 12.
  • Python multiplies with *, subtracts with - and divides with /, and / always gives a decimal answer like 4.5 or 4.0.
  • Python's order of operations does multiplying and dividing before adding and subtracting, so 5 + 2 * 6 gives 17.
  • When dividing and multiplying sit side by side, Python works from left to right, so 18 / 3 * 2 gives 12.0.
  • Python works out what's inside parentheses first, so (5 + 2) * 6 gives 42.
Chapter 2: Values and variables7 lessons · 26 min

This lesson is part of the Python course.

Example plan3 lessons · 11 min

Python values3 min
Numeric expressionsValues and variables5 min
String concatenationValues and variables3 min

An example. Your plan follows your answers, so it can start later and end sooner.

Build my plan

Start free, no account needed.