You are viewing a single comment's thread. Return to all comments →
import re T = int(input().strip())
float_number_pattern = r"^[+-]?([0-9][.][0-9]+|[0-9]+[.][0-9])$"
for _ in range(0,T): string = input().strip() if re.match(float_number_pattern,string): print("True") else: 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 →
import re T = int(input().strip())
float_number_pattern = r"^[+-]?([0-9][.][0-9]+|[0-9]+[.][0-9])$"
for _ in range(0,T): string = input().strip() if re.match(float_number_pattern,string): print("True") else: print("False")