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
Sort by
recency
|
553 Discussions
|
Please Login in order to post a comment
here is my solution
import re l = int(input()) for _ in range(l): N = input() pattern = r"[+-]?\d*.\d+" if re.fullmatch(pattern, N): print("True") else: print("False")
import re print(("True" if re.match(r'^[+-]?\d.\d+$', input().strip()) else "False" for _ in range(int(input()))), sep='\n')
Here is HackerRank Detect Floating Point Number in Python solution - https://programmingoneonone.com/hackerrank-detect-floating-point-number-solution-in-python.html