We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Detect Floating Point Number
Detect Floating Point Number
+ 0 comments import re FLOAT_TYPE = r"[\+|\-]?\d*\.\d+$" T = int(input()) for _ in range(T): print(re.match(FLOAT_TYPE, input()) != None)
+ 0 comments In Test Case 1: +.5486468 is False, but it should be True isn't it?
for _ in range(int(input())): try: float(input()) print(True) except: print(False)
+ 0 comments import re n = int(input()) a = [input() for i in range(n)] pattern = re.compile(r'^[+-.]?\d*.{1}[0-9]{1,}$') for i in a: if (pattern.match(i)): print("True") else: print("False")
+ 0 comments import re [print(bool(re.fullmatch(r"[-+]?\d*\.\d+", input()))) for _ in range(int(input()))]
+ 0 comments import re for _ in range(int(input())): N = input() pattern = re.compile(r'^[\+-]?\d*\.\d+$') matches = pattern.match(N) if matches: print("True") else: print("False")
Load more conversations
Sort 463 Discussions, By:
Please Login in order to post a comment