#!/usr/bin/env python import sys l = [int(line.strip()) for line in open(sys.argv[1])] del l[0] while l[0] != 1: del l[0] while l[-1] != 10: del l[-1] if len(l) < 3490: raise SystemExit, "Too few good samples" m = range(1,11) * (len(l) / 10) for i, (a,b) in enumerate(zip(l, m)): if a != b: print i, a, b if l == m: raise SystemExit, 0 # success raise SystemExit, 1 # failure