You are viewing a single comment's thread. Return to all comments →
This prints True for '0' when I submit code
print(True if re.match(r"^[-+\.]?\d*\.\d*$", input()) else False)
This prints False for '0' when I submit code
print(True if re.match(r"^[-+\.]?\d*\.?\d*$", input()) else False)
what am I missing here?
It should be the reverse, i.e. second statement above should be "True" (see regex101.com link) https://regex101.com/r/dIOXFe/1
Seems like cookies are disabled on this browser, please enable them to open this website
Detect Floating Point Number
You are viewing a single comment's thread. Return to all comments →
This prints True for '0' when I submit code
This prints False for '0' when I submit code
what am I missing here?
It should be the reverse, i.e. second statement above should be "True" (see regex101.com link) https://regex101.com/r/dIOXFe/1