How can I represent an infinite number in python? No matter which number you enter in the program, no number should be greater than this representation of infinity.

0 votes

Best answer

To represent an infinite number in Python, you can run the following code this is float infinity value which will be greater than any other value:

test = float("inf")

To check representation of an infinite number in Python 3.5, you can run the following piece of code:-

import math

test = math.inf

To know more about this you can have a look at the following video tutorial:-