-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnum_py.py
More file actions
60 lines (40 loc) · 980 Bytes
/
Copy pathnum_py.py
File metadata and controls
60 lines (40 loc) · 980 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# +4.50 ✔
# -1.0 ✔
# .5 ✔
# -.7 ✔
# +.4 ✔
# -+4.5 ✖
# 4.08 ✔
# 4. ✔
n=int(input("n: "))
while n != 0:
n-=1
f=input("f: ")
if f.count(".") == 1 :
if f[0] == "+" or f[0] == "-" or f[0] == "." or f[0].isnumeric():
if f.count("+") >= 2 or f.count("-") >= 2:
print(False)
continue
if ("+") in f and ("-") in f:
print(False)
continue
for x in f:
if x.isnumeric() or x == (".") or x == ("+") or x == ("-"):
pass
else:
print(False)
continue
else:
print(True)
else:
print(False)
else:
print(False)
# a="+-.4"
# if ("+") in a and ("-") in a:
# print(False)
# else:
# print(True)
# print(a.count("."))
# lst=a.split(".")
# print(lst)