Skip to content

Instantly share code, notes, and snippets.

@Mu-adventofcode
Created April 30, 2022 20:12
Show Gist options
  • Save Mu-adventofcode/c5ccf7426b162e4701e981edaa86ee03 to your computer and use it in GitHub Desktop.
Save Mu-adventofcode/c5ccf7426b162e4701e981edaa86ee03 to your computer and use it in GitHub Desktop.
Advent of Code 2021 day 01 part 1
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