mirror of
https://github.com/tanishq-dubey/aoc2023.git
synced 2024-12-28 16:57:22 -05:00
d1p1 done
This commit is contained in:
parent
e9e03756f8
commit
a3820f7e2a
1000
day1/input
Normal file
1000
day1/input
Normal file
File diff suppressed because it is too large
Load Diff
24
day1/main.py
24
day1/main.py
@ -0,0 +1,24 @@
|
||||
|
||||
|
||||
data = []
|
||||
with open('input') as f:
|
||||
data = f.readlines()
|
||||
|
||||
|
||||
total = 0
|
||||
|
||||
for d in data:
|
||||
dstring = ''.join(filter(str.isdigit, d))
|
||||
d1 = dstring[0]
|
||||
d2 = dstring[-1]
|
||||
print(d1, "-", d2)
|
||||
total = total + int(f"{d1}{d2}")
|
||||
|
||||
|
||||
print("=======")
|
||||
print(total)
|
||||
print("=======")
|
||||
|
||||
|
||||
|
||||
# Part 2
|
7
day1/test2
Normal file
7
day1/test2
Normal file
@ -0,0 +1,7 @@
|
||||
two1nine
|
||||
eightwothree
|
||||
abcone2threexyz
|
||||
xtwone3four
|
||||
4nineeightseven2
|
||||
zoneight234
|
||||
7pqrstsixteen
|
Loading…
Reference in New Issue
Block a user