#!/usr/bin/python3 larger = 0 current = -1 with open('input.txt', 'r') as myfile: for line in myfile: if int(line.strip()) < current: print('{} is smaller as {}'.format(line.strip(), current)) current = int(line.strip()) else: print('{} is larger as {}'.format(line.strip(), current)) larger = larger + 1 current = int(line.strip()) print('{} measurements are larger than the previous measurement'.format(larger - 1))