Check Tutorial tab to know how to to solve.  

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:  

$>$ Number can start with +, - or . symbol. 

For example: 

+4.50 

-1.0 

.5 

-.7 

+.4 

 -+4.5    

$>$ Number must contain at least $\mbox{I}$ decimal value. 

For example: 

 12. 

12.0     

$>$ Number must have exactly one . symbol. 

$>$ Number must not give any exceptions when converted using $\mbox{float}(N)$.

Input Format

The first line contains an integer $\mathbf{T}$, the number of test cases. 

The next $\mathbf{T}$ line(s) contains a string $N$.

Constraints

$0<T<10$

Output Format

Output True or False for each test case.

Sample Input 0
4
4.0O0
-1.00
+4.54
SomeRandomStuff

Sample Output 0
False
True
True
False

Explanation 0

$4.000$: O is not a digit. 

$-1.00$: is valid. 

$+4.54$: is valid. 

SomeRandomStuff: is not a number.

Difficulty: EASY

Starter code:

Solutions:
import re
for _ in range(int(input())):
	print(bool(re.search('^[-+]?[0-9]*\\.[0-9]+$', input())))


import re
for i in range(int(input())):
	if re.match('^[+-]?\\d*.\\d+$', input().strip()):
		print('True')
	else:
		print('False')


import re
for i in range(int(input())):
	print(bool(re.match('^[+-]?\\d*.\\d+$', input())))


import re
Float = re.compile('^[+-]?\\d*\\.\\d+$')
N = int(input())
for i in range(N):
	print(bool(re.search(Float, input())))


import re
l = []
for i in range(int(input())):
	l.append(input())
pattern = '^[-+]?[0-9]*\\.[0-9]*$'
for i in l:
	print(bool(re.match(pattern, i)))


import re
for _ in range(int(input())):
	s = input()
	print(bool(re.match('^[+-]?[0-9]*\\.[0-9]+$', s)))


import re
for _ in range(int(input())):
	print(bool(re.fullmatch('[+-]?[0-9]*\\.[0-9]+', input())))


import re
print(*[bool(re.match('^[+-]?[\\d]*\\.[\\d]+$', input())) for _ in range(int(input()))], sep='\n')


import re
import sys
rl = lambda : sys.stdin.readline()
p = '(\\+|-){0,1}[0-9]*[.][0-9]+$'
n = int(rl())
case = []
for _ in range(n):
	case.append(rl())
for t in case:
	print(bool(re.match(p, t)))


import re
n = int(input())
exp = '[-+]?(\\d*[.])\\d+$'
for i in range(n):
	s = input()
	print(bool(re.match(exp, s)))


import sys
import re

def is_float():
	iterations = int(sys.stdin.readline())
	while iterations:
		line = sys.stdin.readline()
		line = line.strip()
		tmp = re.search('^[+-]?[0-9]*\\.[0-9]+$', line)
		if tmp:
			sys.stdout.write('True\n')
		else:
			sys.stdout.write('False\n')
		iterations -= 1
	return

def main():
	is_float()
	return
main()


from re import match
t = int(input())
float_regex = '^[-+]?\\d*.\\d+$'
for _ in range(t):
	print(bool(match(float_regex, input())))


import re
p = re.compile('^[+-]?[0-9]*\\.[0-9]+$')
t = int(input())
for i in range(0, t):
	inp = input()
	if p.match(inp):
		print('True')
	else:
		print('False')


import re
for i in range(int(input())):
	try:
		n = input()
		print((bool(float(n)) or False) and bool(re.match('^[+-]?(\\d+)?\\.\\d+$', n)))
	except:
		print(False)


import re
for _ in range(int(input())):
	x = re.search('^[-+]?\\d*\\.\\d+$', input())
	print(bool(x))


import re
for i in range(int(input())):
	s = input().strip()
	print(bool(re.search('^[\\-\\+]?\\d*\\.\\d+$', s)))


import re

def validate(nums):
	if re.match('(\\+|-)*(\\d*)\\.(\\d+)', nums):
		return 'True'
	else:
		return 'False'
no = input()
try:
	no = int(no)
except ValueError:
	print('Input numbers only')
	exit(0)
res = []
for j in range(0, no):
	inp = input()
	try:
		float(inp)
		res.append(validate(inp))
	except:
		res.append('False')
for i in res:
	print(i)


import re
n = int(input())
for i in range(n):
	print(bool(re.match('^[+\\-]?\\d*\\.\\d+$', input())))


import re

def valid(n):
	if re.match('[-+]?(([0-9])*.([0-9]+|[0-9]+))$', n) == None:
		return False
	else:
		return True
for i in range(int(input())):
	print(valid(input()))


import re

def __starting_point():
	t = int(input().strip())
	pattern = '^[+-]?[0-9]*\\.[0-9]+$'
	for _ in range(t):
		print(bool(re.match(pattern, input())))
__starting_point()


import re
pattern = re.compile('[+-]?\\d*\\.\\d+$')
for _ in range(int(input())):
	print(bool(pattern.match(input())))


import re
from collections import Counter
for i in range(int(input())):
	s = input()
	if s.count('.') == 1:
		if s.find('.') + 1 != len(s) and str(s[s.find('.') + 1]).isdigit():
			countt = 0
			for i in range(len(s)):
				if s[i] == '+' or s[i] == '-':
					countt += 1
			if countt <= 1:
				try:
					if float(s):
						print('True')
				except:
					print('False')
			else:
				print('False')
		else:
			print('False')
	else:
		print('False')


import re
T = int(input())
for i in range(T):
	temp = input()
	print(bool(re.match('(\\+|-)?\\d*\\.\\d+$', temp)))


import re
for _ in range(int(input())):
	print(bool(re.match('^[+-\\.]?[0-9]*\\.[0-9][0-9]*$', input())))


import re
for i in range(int(input())):
	num = input()
	try:
		num1 = float(num)
		print(bool(re.search('^[0-9\\-\\+]*\\.[0-9]+$', num)))
	except ValueError:
		print('False')


import re
for _ in range(int(input())):
	print(bool(re.match('((^\\.\\d+$)|(^[\\-\\+]\\d*\\.\\d+$)|(^\\d+\\.\\d+$))', input())))


import re
regex = re.compile('^[-+]?\\d*\\.?\\d+$')
n = int(input())
for _ in range(n):
	in_ = input()
	try:
		c = float(in_)
		if c == 0:
			print(False)
		else:
			print(bool(re.match(regex, in_)))
	except Exception:
		print(False)


import re
pattern = '^[+-]?\\d*\\.\\d+$'
n = int(input())
for i in range(0, n):
	s = input()
	if re.search(pattern, s):
		print('True')
	else:
		print('False')


import re
p = '^[+\\-]?[\\d]*\\.[\\d]+$'
for _ in range(int(input())):
	print(bool(re.match(p, input())))


import re

def main():
	N = int(input())
	for i in range(N):
		print('True' if re.fullmatch('^[+-]?\\d*\\.{1}\\d+$', input()) else 'False')
main()


import re
regex = '^[+-]{0,1}\\d*\\.\\d+$'
T = int(input())
for _ in range(T):
	if re.match(regex, input()):
		print(True)
	else:
		print(False)


import re
import sys
N = int(input())
for _ in range(N):
	if re.match('^[+-]?\\d*.\\d+$', input()):
		print(True)
	else:
		print(False)


import re
for t in range(int(input())):
	n = input()
	print(bool(re.search('^[+-]?[0-9]*[\\.][0-9]+$', n)))


import re
a = int(input())
for i in range(0, a):
	b = input()
	regex = '(^[+-]?[0-9]*\\.[0-9]*)$'
	print(bool(re.search(regex, b)))


import re
n = int(input())
for i in range(n):
	pattern = '^[+-]?\\d*\\.\\d+$'
	if re.search(pattern, input()):
		print('True')
	else:
		print('False')


import re
for _ in range(int(input())):
	print(bool(re.fullmatch('[+-]?\\d*\\.\\d+', input())))


import re
n = int(input())
for i in range(n):
	s = input()
	search_result = re.search('^[+-]?\\d*\\.\\d+$', s)
	print(bool(search_result))


import re
n = int(input())
deciReg = re.compile('(^[+-]?)([0-9])*(\\.[0-9]+$)')

def checkReg(s):
	mo = deciReg.search(s)
	if mo == None:
		print('False')
	else:
		print('True')
for i in range(n):
	s = input()
	checkReg(s)


import re
pattern = re.compile('^[+-]?[0-9]*.[0-9]+$')
for _ in range(int(input())):
	print(pattern.match(input()) != None)


import re
for i in range(int(input())):
	a = input()
	if bool(re.search('(\\d+).(\\d+)', a)) == True:
		b = True
		try:
			check = float(a)
		except ValueError:
			b = False
		print(b)
	else:
		print(False)


import re

def is_number(s):
	try:
		float(s)
		return True
	except ValueError:
		return False
N = int(input())
out = True
for _ in range(N):
	a = input()
	print(bool(re.search('\\.', a)) and is_number(a))


import re
t = int(input())
for _ in range(t):
	num = input()
	print(bool(re.match('^[\\.\\+\\-\\d]\\d*\\.\\d+$', num)))


import re
for i in range(int(input())):
	print(bool(re.search('^[+|-]?[0-9]*\\.[0-9]+$', input())))


import re
N = input().strip()
result = list()
for _ in range(int(N)):
	M = input().strip()
	result.append(bool(re.match('^[+-]?\\d*.\\d+$', M)))
for x in result:
	print(x)


import re

def checkFloat(tocheck):
	return bool(re.match('^[+-]?\\d*\\.{1}\\d+$', tocheck))
ntestcases = int(input())
testcases = []
for i in range(ntestcases):
	testcases.append(str(input()))
for t in testcases:
	print(checkFloat(t))


import re
for i in range(int(input())):
	x = input()
	try:
		float(x)
		print(bool(re.match('[-+]?\\d*\\.\\d*', x)))
	except Exception as e:
		print('False')


for test in range(int(input())):
	N = input()
	try:
		assert N.count('.') == 1 and (not N.endswith('.'))
		float(N)
		print(True)
	except (AssertionError, ValueError):
		print(False)


import re
regex = re.compile('^[+|-]?\\d*\\.{1}\\d+$')
for _ in range(int(input())):
	print(bool(regex.search(input())))


import re
n = int(input())
for _ in range(n):
	n = input()
	print(bool(re.match('^[+-]?\\d*.\\d+$', n)))


import re
n = int(input())
result = []
for i in range(n):
	number = input()
	m = re.match('[+-]?[0-9]*[.][0-9]+', number)
	if bool(m):
		if m.group(0) == number:
			result.append(True)
		else:
			result.append(False)
	else:
		result.append(False)
for out in result:
	print(out)


import re
for i in range(int(input())):
	if re.match('^[+-]?\\d*.\\d+$', input()) is None:
		print('False')
	else:
		print('True')


import re
p = re.compile('^[+\\-]?\\d*\\.\\d+$')
for _ in range(int(input())):
	print(bool(p.match(input())))


import re
N = int(input())
Crit = re.compile('^[+-]?\\d*\\.\\d+')
for i in range(N):
	iStr = input()
	Result = Crit.match(iStr)
	if Result != None and Result.group(0) == iStr:
		print(True)
	else:
		print(False)


import re
n = int(input())
for _ in range(n):
	line = str(input())
	if re.match('^[+-]?\\d*\\.\\d+$', line) is not None:
		print('True')
	else:
		print('False')


import re
T = int(input())
for number in range(T):
	print(bool(re.search('^[-+]?([0-9]\\.[0-9]+|\\.[0-9]+)?$', input())))


import re
import sys
FLOAT_REGEX = '^[-+]?\\d*\\.\\d+$'
T = int(sys.stdin.readline())
for _ in range(T):
	N = sys.stdin.readline().strip()
	print(re.match(FLOAT_REGEX, N) is not None)


import re
reg = re.compile('^[+\\-]?\\d{0,}\\.\\d+$')
for i in range(int(input())):
	s = input()
	if reg.match(s):
		print(True)
	else:
		print(False)


import re
n = int(input())
for _ in range(n):
	s = input()
	is_valid = bool(re.match('^[\\+-]?\\d*\\.\\d+$', s))
	if is_valid:
		try:
			s = float(s)
			is_valid = True
		except:
			is_valid = False
	print(is_valid)


import re
for _ in range(int(input())):
	print(bool(re.search('^[+-]?\\d*.\\d+$', input())))


import re
reg = '^[+-]?\\d*.\\d+$'
n = int(input())
for i in range(n):
	if re.match(reg, input().strip()):
		print(True)
	else:
		print(False)


Regex_Pattern = '^[+-]{0,1}[0-9]*\\.[0-9]+$'
import re
d = int(input())
for i in range(d):
	print(bool(re.search(Regex_Pattern, input())))


import re
T = int(input())
for _ in range(T):
	nextLine = input()
	try:
		float(nextLine)
	except:
		print(False)
		continue
	print(bool(re.match('^[+-]?[0-9]*.[0-9]+$', nextLine)))


import re
n = int(input())
for i in range(0, n):
	s = input()
	s = str(s)
	if bool(re.match('^[+-]?\\d*\\.\\d+', s)) & (not bool(re.search('[a-zA-Z]', s))) & (s.count('.') == 1):
		print(True)
	else:
		print(False)


import re
T = int(input().strip())
for _ in range(T):
	print(bool(re.match('^[+-]?\\d*\\.\\d+$', input().strip())))


import re
n = int(input())
for i in range(0, n):
	number = input()
	if re.search('^(\\+|-)?(\\d*)(\\.\\d+?)$', number) != None:
		print(True)
	else:
		print(False)


import re
pattern = '^[+\\d-]?\\d*[.]\\d+$'
for _ in range(int(input())):
	print(bool(re.search(pattern, input())))


import re
r = '[-+]{,1}\\d*\\.\\d+$'
for _ in range(int(input())):
	if re.match(r, input()):
		print(True)
	else:
		print(False)


import re
N = int(input())
for _ in range(N):
	inp = input()
	print(bool(re.match('^[-+]?[0-9]*\\.[0-9]+$', inp)))


import re
c = int(input())
for i in range(0, c):
	print(bool(re.match('^[-+]?([0-9]*\\.[0-9]+)$', input())))


import re
for _ in range(int(input())):
	print(bool(re.match('^[+-]?\\d*\\.\\d+$', input())))


import re
a = int(input())
for i in range(0, a):
	b = input()
	print(bool(re.match('^[+-]?\\d*.\\d+$', b)))


import re
cases = int(input())
for _ in range(0, cases):
	theInput = input()
	print(bool(re.search('^[\\+,\\-]?\\d*\\.{1}\\d+$', theInput)))


import re
for _ in range(int(input())):
	print(bool(re.match('[+-]?\\d*.\\d+$', input())))


import re
t = int(input())
comparison = re.compile('(|[+-])\\d*([.])\\d+$')
for i in range(t):
	a = input()
	print(bool(comparison.match(a)))


import re
test = int(input())
for _ in range(test):
	curr = input()
	print(bool(re.match('^[+-]?\\d*.{1}\\d+$', curr)))


import re
for i in range(int(input())):
	print(bool(re.search('^[+-]?([0-9]+)?\\.[0-9]+$', input())))


import re
for _ in range(int(input())):
	print(bool(re.match('^[+-]?[0-9]*\\.[0-9]+$', input())))


import re
for _ in range(int(input())):
	print(bool(re.match('^[+-]?\\d*\\.\\d+$', input().strip())))


import re
alpha = re.compile('[0-9+-.]')
dots = re.compile('\\.')
decim = re.compile('\\.\\d')
for k in range(int(input())):
	s = input()
	if not alpha.search(s):
		print('False')
	elif len(dots.findall(s)) > 1:
		print('False')
	elif not decim.search(s):
		print('False')
	else:
		try:
			n = float(s)
			print('True')
		except (ValueError, OverflowError) as e:
			print('False')


import re
[print(bool(re.match('[+-]?\\d*\\.\\d*$', input(), re.I | re.M))) for _ in range(int(input()))]


import re
for i in range(int(input())):
	m = re.match('^[+-]?\\d*\\.\\d+$', input())
	print(bool(m))


import re
R = re.compile('^[+-]?\\d*[.]\\d+$')
i = input()
for x in range(int(i)):
	v = input()
	val = True if R.search(v) else False
	print(val)


import re
digitPattern = re.compile('^(\\-?|\\+?)(\\d*).(\\d+)$')
cases = int(input())
for case in range(cases):
	print(bool(re.match(digitPattern, input())))


import re
t = int(input().strip())
for _ in range(t):
	cur = input().strip()
	print(bool(re.match('[+|-]{0,1}\\d*\\.\\d+$', cur)))


import re
N = int(input())
for _ in range(N):
	print(bool(re.search('^[+-]{0,1}[0-9]*[.][0-9]+$', input().strip())))


import re
for _ in range(int(input())):
	print(bool(re.match('^[+-]?\\d*.\\d+$', input())))


import re
T = int(input().strip())
for i in range(0, T):
	N = input()
	print(bool(re.fullmatch('[/+/-]?\\d*\\.\\d+$', N)))


import sys, re
n = int(input().strip())
for line in range(n):
	item = str(input().strip())
	if re.match('[\\-\\+]?\\d*\\.\\d+$', item):
		print(True)
	else:
		print(False)


import re
regex = re.compile('[+-]?[0-9]*\\.[0-9]+')
for _ in range(int(input())):
	print(regex.fullmatch(input()) != None)


import re
N = int(input())
for _ in range(N):
	print(bool(re.match('[-+]?\\d*\\.\\d+$', input())))


import re
for _ in range(int(input())):
	s = input()
	print(bool(re.search('^[-+]?[0-9]*\\.[0-9]+$', s)))


import re
for i in range(int(input())):
	print(bool(re.match('^(\\+|-)?\\d*.\\d+$', input())))


import re

def main():
	n = int(input())
	for _ in range(n):
		s = input()
		print(bool(re.match('^[+-]?[0-9]*\\.[0-9]+$', s)))
main()


import re
pattern = re.compile('^[+-]?\\d*\\.\\d+$')
T = int(input())
for _ in range(T):
	N = input()
	print(bool(pattern.match(N)))


import re
rfloat = re.compile('^[+-]?\\d?\\.\\d{1,}$')
n_tests = int(input())
for _ in range(n_tests):
	print(bool(re.match(rfloat, input().strip())))


import re
T = int(input())
for each in range(T):
	s = input()
	print(bool(re.search('^[\\+\\-]?\\d*\\.{1}\\d+$', s)))


import re
res = []
for i in range(int(input())):
	s = input()
	if re.match('[\\+\\-]?[1-9]*[.]{1}[0-9]+', s) != None:
		if re.match('[\\+\\-]?[1-9]*[.]{1}[0-9]+', s).span()[0] == 0 and re.match('[\\+\\-]?[1-9]*[.]{1}[0-9]+', s).span()[1] == len(s):
			res.append(True)
		else:
			res.append(False)
	else:
		res.append(False)
print('\n'.join((i for i in map(str, res))))


import re
for i in range(int(input())):
	line = input()
	RegEx = re.compile('(^[-\\+\\s]?\\d*\\.\\d+$)')
	matched = RegEx.match(line)
	if matched == None:
		print('False')
	else:
		print('True')


import re
T = int(input())
for _ in range(T):
	print(bool(re.match('[+-]?\\d*.\\d+$', input())))