Codzy

Numbers and operators

Python calculates like a calculator: + addition, - subtraction, * multiplication, / division (decimal result).

Three very useful operators: // gives the whole-number quotient, % gives the remainder of the division and ** computes a power. As in maths, * and / come before + and -.

print(7 + 2)
print(7 - 2)
print(7 * 2)
print(7 / 2)
print(7 // 2)
print(7 % 2)
print(7 ** 2)

Start the lesson