Detect Floating Point Number

  • + 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")