[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ast <none at gmail.com> writes: > Le 13/02/2019 ? 14:21, ast a ?crit?: >> Hello >> >> >>> float('Nan') == float('Nan') >> False >> >> Why ? >> >> Regards >> > > Thank you for answers. > > If you wonder how I was trapped with it, here > is the failing program. > > > r = float('Nan') > > while r==float('Nan'): > inp = input("Enter a number\n") > try: > r = float(inp) > except ValueError: > r = float('Nan') import math while math.isnan(r) : will do what you're looking for. If you're using python 3.5 or higher, you can also use math.nan instead of float('nan').

- Prev by Date:
**Convert a list with wrong encoding to utf8** - Next by Date:
**Why float('Nan') == float('Nan') is False** - Previous by thread:
**Why float('Nan') == float('Nan') is False** - Next by thread:
**Why float('Nan') == float('Nan') is False** - Index(es):