Sunday, December 9, 2018

Generate Positive Infinity and negative Values using Python

We can generate the Infinity values using Python. We need import math library to do this.


import math
x=math.inf

y=-math.inf

you need to keep - before to generate negative infinity

print(x)

The above prints positive infinity

print(y)

Above one print negative infinity

print(math.isinf(x))

prints true

print(math.isinf(y))

print true

No comments: