Detect Floating Point Number

  • + 0 comments
    import re
    
    t = int(input())
    values = [input() for i in range(t)]
    
    regex = r"^[+-]?\d*\.\d+$"
    floats = (bool(re.match(regex, i)) for i in values)
    
    for _ in floats:
        print(_)