>>> import sys >>> x = 1 >>> for i in range(10): ... x = x + 1 ... if x > 7: ... print x ... sys.exit() ... 8