Math with Python

Python is considered one of the best programing languages for performing mathematical computations. It has multiple built-in math functions that can be used to perform computations. Furthermore, programmers can import the math library which consists of hundreds of more Python methods that can be used to perform such operations.

Built-in math functions

min() - used to find the lowest value in a iterable(like a list formated [x,y,z] or tuple formatted (x,y,z))

max() - used to find the highest value in an iterable

abs() - returns the absolute value of the specified number

pow(x,y) - returns the value of x to the power of y

There are many more built-in functions. Here, we only discussed a few.

Math module

If you import the math module by typing 'import math', then you get access to many other useful mathematical functions.

math.sqrt(x) - returns the square root of a the number you input or x.

math.ceil() - rounds a number up to the nearest integer.

math.floor() - rounds a number down to the nearest integer

math.pi - returns the value of PI(3.1415...)

You can learn about many more math module functions by visiting the math library.