← Python Programming
Python foundations · 15 MIN

Operators and expressions

Operators and expressions

Arithmetic operators include +, -, *, /, //, %, and **. Comparisons return booleans. and, or and not combine conditions. Parentheses make complex expressions easier to read.

Try it yourself

Change the example, run it, and explain the result in your own words. Then create one variation of your own.

Key idea

Use the example as a starting point, not something to memorize. Practise, inspect the result and make small improvements.

Code example

price = 1200
quantity = 3
total = price * quantity
print(total, total >= 3000)