add: Day1
This commit is contained in:
16
Day1/day1_p1.py
Normal file
16
Day1/day1_p1.py
Normal file
@@ -0,0 +1,16 @@
|
||||
f = open("input.txt", "r")
|
||||
|
||||
tot = 0
|
||||
for line in f.readlines() :
|
||||
temp = 0
|
||||
for c in line :
|
||||
if c.isdigit() :
|
||||
temp = int(c) * 10
|
||||
for d in line[::-1] :
|
||||
if d.isdigit() :
|
||||
temp += int(d)
|
||||
break
|
||||
break
|
||||
tot += temp
|
||||
print(tot)
|
||||
f.close()
|
||||
Reference in New Issue
Block a user