21 lines
538 B
Python
21 lines
538 B
Python
|
sum = 0
|
||
|
|
||
|
nums = ["one", "two", "three", "four", "five", "six", "seven", "eight", "nine"]
|
||
|
|
||
|
with open("test.txt") as f:
|
||
|
for curr in f.readlines():
|
||
|
print(curr[:-1])
|
||
|
num = []
|
||
|
for c in range(len(curr)):
|
||
|
if curr[c].isnumeric():
|
||
|
num.append(curr[c])
|
||
|
break
|
||
|
|
||
|
for c in range(len(curr), 0, -1):
|
||
|
if curr[c-1].isnumeric():
|
||
|
num.append(curr[c-1])
|
||
|
break
|
||
|
print(int("".join(num)))
|
||
|
sum += int("".join(num))
|
||
|
print(sum)
|