In [1]:
f_inf = float('inf')

In [2]:
print(f_inf)


inf

In [3]:
print(type(f_inf))


<class 'float'>

In [4]:
f_inf_minus = -float('inf')

In [5]:
print(f_inf_minus)


-inf

In [6]:
print(type(f_inf_minus))


<class 'float'>

In [7]:
# print(int(f_inf))
# OverflowError: cannot convert float infinity to integer

In [8]:
print(str(f_inf))


inf

In [9]:
print(type(str(f_inf)))


<class 'str'>

In [10]:
print(float('inf'))


inf

In [11]:
print(float('infinity'))


inf

In [12]:
print(float('INF'))


inf

In [13]:
print(float('INFinity'))


inf

In [14]:
import sys

In [15]:
f_inf_num = sys.float_info.max * 2

In [16]:
print(f_inf_num)


inf