You are viewing a single comment's thread. Return to all comments →
import re pattern = r"^[-+]?[0-9]*\.[0-9]+$" iter = int(input()) for i in range(iter): try: num_str = input() if not re.match(pattern, num_str): print("False") else: print("True") except ValueError: print("False")
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 →