summaryrefslogtreecommitdiffstats
path: root/day1/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'day1/__init__.py')
-rw-r--r--day1/__init__.py17
1 files changed, 2 insertions, 15 deletions
diff --git a/day1/__init__.py b/day1/__init__.py
index ee66fd3..ea27c01 100644
--- a/day1/__init__.py
+++ b/day1/__init__.py
@@ -10,10 +10,7 @@ class Assignment(BaseAssignment, ABC):
10 def run(self, input: Iterator[list[int]]) -> int: 10 def run(self, input: Iterator[list[int]]) -> int:
11 input = list(input) 11 input = list(input)
12 print(input) 12 print(input)
13 return sum([ 13 return sum([int(f"{item[0]}{item[-1]}") for item in input])
14 int(f'{item[0]}{item[-1]}')
15 for item in input
16 ])
17 14
18 15
19class AssignmentOne(Assignment): 16class AssignmentOne(Assignment):
@@ -53,18 +50,8 @@ class AssignmentTwo(Assignment):
53 numbers[index] = int(i) 50 numbers[index] = int(i)
54 51
55 return [ 52 return [
56 value 53 value for key, value in sorted(numbers.items(), key=lambda item: item[0])
57 for key, value
58 in sorted(
59 numbers.items(),
60 key=lambda item: item[0]
61 )
62 ] 54 ]
63 55
64 def parse_item(self, item: str) -> list[int]: 56 def parse_item(self, item: str) -> list[int]:
65 return self._parse_item(item) 57 return self._parse_item(item)
66
67
68
69
70