Skip to content

Math

Addition

1 + 1
2

Subtraction

1 - 1
0

Multiplication

2 * 2
4

Division

  • Fractions always return a floating number, even if the result is a whole number.
4 / 2
2.0

Integer division (floor division) can be performed using the // operator, which will return the largest integer less than or equal to the result of the division.

5 // 2
2

Division reminder can be calculated using the modulus operator %, which returns the remainder of the division of two numbers.

5 % 2
1

Power

5**2
25