Python Math - how to create
Python Tutorial » Python Math
Python Math Library provides access to some common math functions and constants.
Python has a set of built-in math functions library and you don't have to do any installation to use it.
min() and max() functions is used to find the lowest or highest value.
Example:
Output:
4
98
a = min(4, 8, 12, 23, 45, 98)
b = max(4, 8, 12, 23, 45, 98)
print(a)
print(b)
b = max(4, 8, 12, 23, 45, 98)
print(a)
print(b)
Output:
4
98
Built-in Math Functions
Here is a list of functions and attributes defined in math module with an explanation.
1. min() and max() - lowest or highest value in an iterable:
2. abs() - the absolute (positive) value of a number:
3. ceil(x) - the smallest integer greater than or equal to x.
4. fabs(x) - absolute value of x
5. pow(x, y) - value of x to the power of y (xy).
6. floor(x) - the largest integer less than or equal to x
7. isinf(x) - True if x is a positive or negative infinity
8. ldexp(x, i) - x * (2**i)
9. log2(x) - returns the base-2 logarithm of x
10. sqrt(x) - the square root of x
11. acos(x) - the arc cosine of x
12. asin(x) - the arc sine of x
13. sin(x) - the sine of x
14. pi Mathematical constant 3.14159
15. e mathematical constant 2.71828
How to use Built-in Math Functions - example
The pow(x, y) function returns the value of x to the power of y (xy).
Example: Return the value 3 to the power of 5 (as 3*3*3*3*3):
Output: 243
x = pow(3, 5)
print(x)
print(x)
Output: 243
The Math Module
Python has also a built-in module called math.To use it, you must import math module as:
Example: math.sqrt() method
import math
y = math.sqrt(144)
print(y)Python Math, function, sqrt, operation, domain error, abs, operators, radical, pi, round, log
Python Math - python
Online Editor
This tool makes it easy to create, adjust, and experiment with custom colors for the web.
HTML Templates

Magnews2 is a modern and creative free magazine and news website template that will help you kick off your online project in style.
CSS HTML Layout

Find here examples of creative and unique website layouts.
Free CSS HTML Menu

Find here examples of creative and unique website CSS HTML menu.