Skip to content

Commit 4334cea

Browse files
authored
Merge pull request #2 from nylocx/patch-1
Update main.py
2 parents a0a8518 + 1a46b76 commit 4334cea

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

day04/main.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
with open("input.txt") as f:
2-
lines = [[[int(i) for i in k.split("-")] for k in x.split(",")] for x in f]
2+
lines = [[*map(int, x.replace("-", ",").split(","))] for x in f]
33

4-
print(sum(a <= c <= d <= b or c <= a <= b <= d for (a,b), (c,d) in lines))
5-
print(sum(a <= d and b >= c for (a,b), (c,d) in lines))
4+
print(sum(a <= c <= d <= b or c <= a <= b <= d for a, b, c, d in lines))
5+
print(sum(a <= d and b >= c for a, b, c, d in lines))

0 commit comments

Comments
 (0)