math.isnan()
Checks if the float x is a NaN (not a number). NaNs are part of the IEEE 754 standards. Operation like but not limited to inf * 0, inf / inf or any operation involving a NaN, e.g. nan * 1, return a NaN.
New in version 2.6.
>>> import math
>>> x=float('nan')
>>> math.isnan(x)
True
>>>
Hope this helps!!
If you need to learn more about Python, It's recommended to join Python Programming course today.
Thanks!