How to Represent an Infinite Number in Python?
How to Represent an Infinite Number in Python?
To represent an infinite number you need to define a specific rule. For example, the infinite number in the examples of this article is represented as a string developed in the Python programming language. If you have any questions or suggestions kindly use the comment section and help us build a better article.
python infinite value
By
Ugliest Unicorn on Mar 26, 2020
test = float("inf")
In Python 3.5, you can do:
import math
test = math.inf5
infinity in python
By
Aggressive Addax on Jan 31, 2021
# Defining a positive infinite integer
positive_infnity = float('inf')
print('Positive Infinity: ', positive_infnity)
# Defining a negative infinite integer
negative_infnity = float('-inf')
print('Negative Infinity: ', negative_infnity)
Comments
Post a Comment