Math Module of Python

The math module contains definitions for many other often-used mathematical functions such as,

    Trigonometric functions,

    Representation functions,

    Logarithmic functions,

    Angle conversion functions, etc.

In addition, two mathematical constants- pi and e are also defined in this module.

In Mathematics, Pi is a well-known mathematical constant. Its value is 3.141592653589793. Open the Python IDLE shell. Type the following code:

>>> import math
>>> math.pi

Output:

3.141592653589793

Another well-known mathematical constant is e, which is known as Euler’s number. Its value equals 2.718281828459045.

>>> import math
>>> math.e

Output:

2.718281828459045

Do you want to become an expert programmer? See books helping our students, interns, and beginners in software companies today (Click here)!

Leave a Comment

Python Tutorials