float('nan') represents NaN (not a number). But how do I check for it?
float('nan')
Use math.isnan:
math.isnan
>>> import math >>> x = float('nan') >>> math.isnan(x) True