Skip to content

Commit 5eda897

Browse files
committed
Add function that returns sum of all gear ratios in the engine schematic
1 parent 2bfdcea commit 5eda897

File tree

1 file changed

+7
-1
lines changed
  • puzzles/solutions/2023/d03

1 file changed

+7
-1
lines changed

puzzles/solutions/2023/d03/p2.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
import sys
22

3+
from schematic_parser import SchematicParser
4+
35

46
def get_answer(input_text: str):
5-
raise NotImplementedError
7+
"""Return the sum of all gear ratios in the engine schematic."""
8+
schematic_parser = SchematicParser(input_text)
9+
schematic_parser.find_part_numbers()
10+
schematic_parser.find_gears()
11+
return schematic_parser.calculate_gear_ratios_sum()
612

713

814
if __name__ == "__main__":

0 commit comments

Comments
 (0)