Python isnan() Function

isnan() function exists in Standard math Library of Python Programming Language and is used to determine whether a given parameter is a valid number or not.
If given number x as parameter is a valid Python number (Positive or Negative), isnan() function returns False.
If given number x as a parameter is NaN (Not a Number), isnan() returns True.

Syntax of isnan() in Python

The syntax of isnan() function in python is:
math.isnan( x )


Parameters of Python isnan() Function

x is any valid Python data type. This parameter is required.


Python isnan() Function Compatibility

Python 2.x – Yes
Python 3.x – Yes


Return Value of Python isnan() Function

The return value of isnan() function is either True or False.


Python isnan() Function Example

Output of Python isnan() function