Created
April 30, 2022 20:12
-
-
Save Mu-adventofcode/c5ccf7426b162e4701e981edaa86ee03 to your computer and use it in GitHub Desktop.
Advent of Code 2021 day 01 part 1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def count_increases(report): | |
lst = [int(n) for n in report.split()] | |
return sum(1 if x2 > x1 else 0 for x1, x2 in zip(lst[:-1], lst[1:])) | |
if __name__ == "__main__": | |
with open("input.txt") as f: | |
print(count_increases(f.read())) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment