infinity python
test = float("inf")
In Python 3.5, you can do:
import math
test = math.inf
3
2
math.inf
Thank you!
2
0
4.43
7
# Define Negative infinity number
ntive_inf = float('-inf')
print('Negative Infinity: ',ntive_inf)
Thank you!
7
0
4.3
10
# Import math Library
import math
# Print the positive infinity
print (math.inf)
# Print the negative infinity
print (-math.inf)
Thank you!
10
0
3
1
# 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)
Thank you!
1
0
3.9
11
test = float("inf")
Thank you!
11
0
Are there any code examples left?
New code examples in category Python