Python math.nan Constant
Python math.nanReturns a floating-point value nan (not a number), which is not a legal number.
math.nanEquivalent tofloat('nan')the output of
Syntax
The syntax of the math.nan constant is as follows:
math.nan
Return Value
Returns a floating-point number nan.
Example
The following example returns nan:
Example
# Import the math package
import math
# Output nan
print (math.nan)
# Output nan type
print (type(math.nan))
import math
# Output nan
print (math.nan)
# Output nan type
print (type(math.nan))
Output result:
nan <class 'float'>Other Extensions
Python math Module