Numbers are very important in Python. Simple commands can quickly solve mathematical expressions and equations.
Adding, subtracting, multiplying, and dividing are written intuitively in Python. (Python follows the order of operations)
When converting a string into a number remember to convert it to an integer first.
When dealing with decimals use floats. If you don’t, your code will break.
These commands are useful when dealing with numbers. Below, number represents any numerical variable:
abs(number): Absolute value of number
pow(10, 3): another possible exponential expression, 10 is the base and 3 is the exponent
max(4, 10): returns the largest number
min(4, 10): returns the smallest number
round(4.6): rounds 4.6 to the nearest whole number
round(3.1415, 3): Rounds 3.1415 to 3 decimal places. (Would return 3.142)