It’s possible to do mathematical operations with variables in Python. We have already seen that it’s possible to add them with + and multiply them with *. The full list of possible operations is:
Operation
Description
With variables
Example with numbers
+
Addition
a + b
10 + 7 ⇒ 17
-
Subtraction
a - b
10 - 7 ⇒ 3
*
Multiplication
a * b
10 * 7 ⇒ 70
/
Division
a / b
10 / 7 ⇒ 1.4285714285714286
//
Floor division
a // b
10 // 7 ⇒ 1
%
Modulus (remainder after division)
a % b
10 % 7 ⇒ 3
**
Exponent
a**b
10**7 ⇒ 10000000
Challenge
Write a program that would input a number x and print x - 1, x, and x + 1 in the output.