Skip to content

Commit 4ebb2bc

Browse files
committed
Create mapping from digits names to numbers
1 parent 6b8e329 commit 4ebb2bc

File tree

1 file changed

+4
-6
lines changed
  • puzzles/solutions/2023/d01

1 file changed

+4
-6
lines changed

puzzles/solutions/2023/d01/p2.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@
33
import p1
44

55

6-
TRANSLATION_TABLE = str.maketrans(
7-
dict(
8-
zip(
9-
("one", "two", "three", "four", "five", "six", "seven", "eight", "nine"),
10-
range(1, 10),
11-
)
6+
DIGITS_NAMES_TO_NUMBERS = dict(
7+
zip(
8+
("one", "two", "three", "four", "five", "six", "seven", "eight", "nine"),
9+
(map(str, range(1, 10))),
1210
)
1311
)
1412

0 commit comments

Comments
 (0)