how to create inf in python code example
Example 1: infinity in python
# 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)
Example 2: python math negative infinity
# Import math Library
import math
# Print the positive infinity
print (math.inf)
# Print the negative infinity
print (-math.inf)