How to enter infinity keyword?

Whenever I use “inf” to check for infinity…I get this error message (global name ‘inf’ is not defined)
I have tried also to import math module and use math.inf, and it still does not work

Any clues?

Import the math module by the command: import math.
Then just use math.inf wherever you need to call inf.
You can also use the command: from math import inf.
That way you can call it just by the inf keyword

1 Like

Thank you for your reply.
I have already did that, and I got the following error message:
‘module’ object has no attribute ‘inf’

I found a solution. I can just add this line “inf=float(‘inf’)” in my code, and inf keyword will act as an unbounded upper value

2 Likes