We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 232e2dd commit ce1f570Copy full SHA for ce1f570
puzzles/solutions/2023/d01/p2.py
@@ -16,10 +16,9 @@ def _convert_digits_names_to_numbers(input_text: str) -> str:
16
for line in input_text.splitlines():
17
new_line = line[0]
18
for i in range(1, len(line)):
19
- current_part_of_line = line[: i + 1]
20
new_line += line[i]
21
for digit_name in DIGITS_NAMES_TO_NUMBERS:
22
- if current_part_of_line.endswith(digit_name):
+ if line.endswith(digit_name, 0, i + 1):
23
new_line += DIGITS_NAMES_TO_NUMBERS[digit_name]
24
new_text += new_line + "\n"
25
return new_text
0 commit comments