-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path76.py
More file actions
30 lines (27 loc) · 970 Bytes
/
76.py
File metadata and controls
30 lines (27 loc) · 970 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Enter your code here. Read input from STDIN. Print output to STDOUT
#finding float value is true or false
t=int(input())
k=[]
for i in range(t):
n=input()
c=n.count('.')
if c==1:
ind=n.index('.')
if n[-1]=='.' or n.isalnum() or n.isalpha() or '.' not in n or '-+' in n or '+-' in n: #return False
k.append(False)
elif (n[0]=='+' or n[0]=='-') and n[1:ind].isdigit() and n[ind+1:].isdigit():
k.append(True)
elif n[0]=='.' and n[1:].isdigit():
k.append(True)
elif (n[0]=='+' or n[0]=='-') and n[1]=='.' and n[2:].isdigit():
k.append(True)
elif n[0].isdigit() and n[:-1].isdigit():
k.append(True)
elif n[0].isdigit() and n[ind+1:].isdigit() and n[:ind].isdigit():
k.append(True)
else:
k.append(False)
else:
k.append(False)
for j in k:
print(j)