#!/usr/bin/env python curr = None count = 0 with open("day1.txt") as input: for line in input: line = int(line) if not curr: curr = line continue if line > curr: count += 1 curr = line print(count) curr = None count = 0 with open("day1.txt") as input: first = int(next(input)) second = int(next(input)) third = int(next(input)) while True: if not curr: curr = first + second + third continue if first + second + third > curr: count += 1 curr = first + second + third try: first = second second = third third = int(next(input)) except StopIteration: break print(count)