HackerRank Python - Detect Floating Point Number

You are given a string N.
Your task is to verify that N is a floating point number.

In this task, a valid float number must satisfy all of the following requirements:

  1. # Enter your code here. Read input from STDIN. Print output to STDOUT
  2. from re import match, compile
  3. pattern = compile('^[-+]?[0-9]*\.[0-9]+$')
  4. for _ in range(int(input())):
  5. print(bool(pattern.match(input())))

download android app