# Python Programming Language: Math Module Constants

Hi everyone, welcome back. In these examples, we will be going over the constants that are included within the math module. The math module is a module that is provided by Python that contains mathematical functions that can be used in your project. We will be going over the constants that are provided within the math module. With this introduction out of the way, let’s get into it.

# Importing The Math Module

We will need to import the math module into our project in order to access its functions and properties. Let’s see how we can do that:

`import math`

Now that our math module is imported into our project, let’s start going over the constants that are provided.

# Constants

## Pi

Let’s start by going over the pi constant. We can access this value by using the pi constant. Let’s see an example:

`import mathprint(math.pi)Output:3.141592653589793`

In the example above, we can see that we are successfully retrieving the pi constant from the math module.

## E

Now let’s see how we can access the e(Euler’s number) constant. We can access this value by using the e constant. Let’s see an example:

`import mathprint(math.e)Output:2.718281828459045`

In the example above, we can see that we are successfully retrieving the e constant from the math module.

## Tau

Now let’s see how we can access the Tau constant. We can access this value by using the tau constant. Let’s see an example:

`import mathprint(math.tau)Output:6.283185307179586`

In the example above, we can see that we are successfully retrieving the tau constant from the math module.

## Infinity

Now let’s see how we can access the Infinity constant. We can access this value by using the inf constant. Let’s see an example:

`import mathprint(math.inf)Output:inf`

In the example above, we can see that we are successfully retrieving the inf constant from the math module.

## Nan

Now let’s see how we can access the Nan constant. We can access this value by using the nan constant. Let’s see an example:

`import mathprint(math.nan)Output:nan`

In the example above, we can see that we are successfully retrieving the nan constant from the math module.

# Conclusion

That is it for the constants in the math module. We went over all of the constants that are included with the built in math module that is provided with Python. I hope this helps. If you have any questions or comments, please let me know. Thanks for reading.

--

--

Hi, I'm a passionate technology enthusiast and lifelong learner. Beyond my technical pursuits, I'm also passionate about sharing my enthusiasm with others.