Python isnan

The Python isnan function is one of the Mathematical function, which is used to check whether the given value is a valid number or not. If it is Positive or Negative value then Python isnan returns False otherwise, True.

The syntax of the isnan in Python Programming Language is as shown below

math.isnan(value)

Python isnan example

This is a simple example of isnan function to check whether zero is a valid number or not.

#Python isnan
import math
print(math.isnan(0))

OUTPUT

Here, we are using the isnan function on different values of both positive and negative. We have also used math.pi inside this isnan function.