Theory

Python can work as a calculator! Use these operators:

+ addition (сложение)
- subtraction (вычитание)
* multiplication (умножение)
/ division (деление)

Examples / Примеры:

result = 5 + 3 # result is 8
result = 10 - 4 # result is 6
result = 3 * 4 # result is 12
result = 15 / 3 # result is 5.0

You can also print calculations directly:

print(2 + 2) # Will display: 4

Exercises in this lesson

4

Rectangle Area

Calculate the area of a rectangle with width = 5 and height = 4. Area = width * height Store the result in 'area' and display it.

Medium Points: 20
Solve in the playground

Frequently asked questions

What is the lesson “Math Operations” about?

Learn basic math operations in Python: addition, subtraction, multiplication, and division.

How many exercises are in this lesson?

This lesson has 4 exercises.

Do I need to install anything to do the exercises?

No. The code is written and run in the browser.

Next lesson: Strings →