Built-in operators
Python understands mathematical expressions, following the same order of operations you learned in math class. For example,
>>> 1 + 1
2
>>> 6 - 2
4
>>> 5 * 5
25
>>> 10 / 2
5
>>> (3 - 1) * (2 + 2)
8
Python understands mathematical expressions, following the same order of operations you learned in math class. For example,
>>> 1 + 1
2
>>> 6 - 2
4
>>> 5 * 5
25
>>> 10 / 2
5
>>> (3 - 1) * (2 + 2)
8