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.
<ul>
<li><code>+ addition
<li><code>- subtraction
<li><code>* multiplication
<li><code>/ division
<li><code>** exponent
<li><code>% remainder
<li><code>< less- than
<li><code>> greater- than
<li><code><= less- than- equal
<li><code>>= greater- than- equal
<p dir="auto"><strong>What is <em>integer: each item in this list [-infinity, ..., -3, -2, -1, 0, 1, 2, 3, ..., infinity] is an integer.<br />
All the above operators are valid for integers.
<pre><code>>>> 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
<p dir="auto"><strong>What is the order of operations?: Parentheses - Exponents - Multiplication - Division - Addition - Subtraction.
<p dir="auto">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.
<pre><code>>>> 2 + 3 * 4
14
<p dir="auto">Use parenthesis to specify the explicit groups.
<pre><code> >>> (2 + 3) * 4
20