Skip to content

Commit 29e8ddf

Browse files
committed
Linting to stop people complaining
1 parent d1de41f commit 29e8ddf

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

2024/day_07/Python/operators.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import operator as op
22
import itertools
33

4+
45
def load_input(filename: str) -> list:
56
with open(filename, "r") as file:
67
lines = file.readlines()
@@ -17,7 +18,8 @@ def process_input(lines):
1718

1819
return answers, values
1920

20-
def check_equation(answer, values, pos_operators = [op.add, op.mul]):
21+
22+
def check_equation(answer, values, pos_operators=[op.add, op.mul]):
2123
Noperators = len(values) - 1
2224

2325
operator_list = itertools.product(pos_operators, repeat=Noperators)
@@ -29,6 +31,7 @@ def check_equation(answer, values, pos_operators = [op.add, op.mul]):
2931
if result == answer:
3032
return True
3133

34+
3235
def concatenate_operator(a, b):
3336
return int(str(a) + str(b))
3437

@@ -63,4 +66,4 @@ def do_puzzle(answer, values, pos_operators):
6366
# Part 2:
6467
print("Answer Part 2:")
6568
pos_operators = [op.add, op.mul, concatenate_operator]
66-
do_puzzle(answers, values, pos_operators)
69+
do_puzzle(answers, values, pos_operators)

2024/day_08/Python/antinodes.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
from itertools import combinations
33
import numpy as np
44

5+
56
def load_input(filename):
67
"""
78
Load the puzzle input from a file.
89
"""
9-
with open(filename, 'r') as file:
10+
with open(filename, "r") as file:
1011
lines = file.readlines()
1112

1213
new_lines = []
@@ -35,6 +36,7 @@ def find_antinodes(coordinateA, coordinateB):
3536

3637
return antinodeA, antinodeB
3738

39+
3840
if __name__ == "__main__":
3941
puzzle_input = load_input("input.txt")
4042

@@ -51,14 +53,15 @@ def find_antinodes(coordinateA, coordinateB):
5153
for antenna in combinations(antennae, 2):
5254
antinodes.extend(find_antinodes(antenna[0], antenna[1]))
5355

54-
5556
antinodes = set(map(tuple, antinodes))
5657
print(antinodes)
5758

5859
# Remove out of bounds
5960
antinodes = [
60-
antinode for antinode in antinodes if all(0 <= coord < bound for coord, bound in zip(antinode, puzzle_bounds))
61+
antinode
62+
for antinode in antinodes
63+
if all(0 <= coord < bound for coord, bound in zip(antinode, puzzle_bounds))
6164
]
6265
print(len(antinodes))
6366

64-
# Part 2 here
67+
# Part 2 here

0 commit comments

Comments
 (0)