-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtempCodeRunnerFile.py
More file actions
56 lines (45 loc) · 1.09 KB
/
tempCodeRunnerFile.py
File metadata and controls
56 lines (45 loc) · 1.09 KB
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
def normal(n):
print(int(n)+1)
def float_func(n:str):
if n[-3] in ("."):
print(float(n)+1)
else:
return print("ERROR")
def comma(n:str):
for ch in n[-4::-4]:
if ch == ",":
n = n.replace(",","")
result = int(n)+1
else:
result = "ERROR"
print(result)
def dotcomma(n:str):
if n[-3] in ("."):
for ch in n[-7::-4]:
if ch == ",":
n = n.replace(",","")
result = float(n)+1
else:
result = "ERROR"
print(result)
else:
return print("ERROR")
def alphabet(n):
for i in n:
if i in ",." :
continue
if (ord(i)) < 48 and (ord(i) > 57):
return False
return True
n = str(input())
if alphabet(n) :
if ("." not in n) and ("," not in n):
normal(n)
elif ("." in n) and ("," not in n):
float_func(n)
elif ("," in n) and ("." not in n):
comma(n)
elif ("." in n) and ("," in n):
dotcomma(n)
else:
print("ERROR")