ExampleEdit & Run
#import the cmath module
import cmath

print(cmath.nan)
Output:
nan[Finished in 0.010606307070702314s]

The cmath(complex math) module defines the nan attribute which represents the NaN value. In the context of complex numbers, NaN(not a Number) values are used to represent complex arithmetic operations that yield an undefined result.

Syntax:
cmath.nan
ExampleEdit & Run
import cmath

print(cmath.nan + 2)
print(-cmath.nan)
Output:
nannan[Finished in 0.010005685966461897s]