code cleanup
This commit is contained in:
parent
6d77259384
commit
63eafb5f42
18
day01.py
18
day01.py
@ -13,24 +13,20 @@ class Day(AOCDay):
|
|||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
def part1(self):
|
def count(self, step: int = 1) -> int:
|
||||||
count = 0
|
count = 0
|
||||||
depths = self.getInputListAsType(int)
|
depths = self.getInputListAsType(int)
|
||||||
for x in range(1, len(depths)):
|
for x in range(step, len(depths)):
|
||||||
if depths[x] > depths[x-1]:
|
if depths[x] > depths[x - step]:
|
||||||
count += 1
|
count += 1
|
||||||
|
|
||||||
return count
|
return count
|
||||||
|
|
||||||
|
def part1(self):
|
||||||
|
return self.count()
|
||||||
|
|
||||||
def part2(self):
|
def part2(self):
|
||||||
count = 0
|
return self.count(3)
|
||||||
depths = self.getInputListAsType(int)
|
|
||||||
|
|
||||||
for x in range(3, len(depths)):
|
|
||||||
if depths[x] > depths[x-3]:
|
|
||||||
count += 1
|
|
||||||
|
|
||||||
return count
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user