# infinity

> Infinity Infinity in python can be represented in multiple ways. Positive infinity number is greatest, and the negative infinity number is the smallest of all numbers. Or More info here

- Canonical: https://preview.arshadmehmood.com/today-i-learned/python/infinity/
- Section: python
- Author: Arshad Mehmood

#Infinity
Infinity in python can be represented in multiple ways. Positive infinity number is greatest, and the negative infinity number is the smallest of all numbers.

```python
import math

# Positive infinity
ptive_inf = math.inf
print('Positive Infinity: ',ptive_inf)

# Negative infinity
ntive_inf = -math.inf
print('Negative Infinity: ',ntive_inf)
```
Or
```python
# Define Positive infinity number
ptive_inf = float('inf')
print('Positive Infinity: ',ptive_inf)

# Define Negative infinity number
ntive_inf = float('-inf')
print('Negative Infinity: ',ntive_inf)
```

More info [here](https://www.stechies.com/python-infinity/)

