#import the math module
import math

#Use the isfinite function
print(math.isfinite(-1000))
print(math.isfinite(float('inf')))

The math.isfinite() function is used to check whether a number is finite or not.

In Python, a finite number is any number that is not Infinite or Nan, such as an integer, float, complex number, etc.

math.isfinite(x)
x The numerical value which we want to check whether it is finite or not. It should be a real number i.e a floating point value or an integer.

The function returns True if is finite. Otherwise False.

import math

print(math.isfinite(0))
print(math.isfinite(7))
print(math.isfinite(-10))
print(math.isfinite(100.11))
print(math.isfinite(math.pi))

The function is applicable  when dealing with mathematical operations that can result in infinity or not a number (NaN). 

Infinity (  ) is a mathematical concept that is used to describe a number that is greater than any other number. It is used to signify an unbounded or unending value, quantity, or magnitude.

Nan, on the other hand, is an acronym that stands for Not a Number. It is  used to denote the result of erroneous operations such as division by zero or the square root of a negative number. 

In Python, Infinity, is represented as float('inf') or float('-inf') for negative infinity. While Nan is represented as float('nan'). If these two values are passed as arguments to the math.isfinite() function, False, will be returned.

import math

print(math.isfinite(float('inf')))
print(math.isfinite(float('-inf')))
print(math.isfinite(float('nan')))

The math module also includes Infinity and Nan.

import math

print(math.isfinite(math.inf))
print(math.isfinite(-math.inf))
print(math.isfinite(math.nan))