Skip to content

Commit

Permalink
check if spelled-out numbers are in strings
Browse files Browse the repository at this point in the history
  • Loading branch information
junefish committed Dec 1, 2023
1 parent ecdc091 commit d7fca3a
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion adventofcode2023/day1/day1problem2.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,21 @@
for line in input:
calibrations.append(line.strip())

print(calibrations)
# print(calibrations)

digits = {
"one": 1,
"two": 2,
"three": 3,
"four": 4,
"five": 5,
"six": 6,
"seven": 7,
"eight": 8,
"nine": 9
}

for value in calibrations:
for key,num in digits.items():
if(key in value):
print(key)

0 comments on commit d7fca3a

Please sign in to comment.