Every programming language has numbers which is a way to do math. Doing math with python is easy. First lets look what operators do we have and then we will see how to use this operators.
+
addition-
subtraction*
multiplication/
division**
exponent%
remainder<
less- than>
greater- than<=
less- than- equal>=
greater- than- equal
What is integer: each item in this list [-infinity, ..., -3, -2, -1, 0, 1, 2, 3, ..., infinity] is an integer.
All the above operators are valid for integers.
>>> 25 + 30
55
>>> 7 - 2
5
>>> 4 % 2
0
>>> 2 ** 7
128
>>> 5 > 7
False
>>> 7 > 5
True
>>> print('Is it greater or equal?', 3 >= 9)
Is it greater or equal? False
>>> 1 - 5 + 4 % 2
-4
What is the order of operations?: Parentheses - Exponents - Multiplication - Division - Addition - Subtraction.
When we compute 2 + 3 * 4, 3 * 4 is computed first as the precedence of * is higher than + and then the result is added to 2.
>>> 2 + 3 * 4
14
Use parenthesis to specify the explicit groups.
>>> (2 + 3) * 4
20