I have a couple of lists which vary in length, and I would like to compare each of their items with an integer, and if any one of the items is above said integer, it breaks
Well, I'd probably do it using the generator expression, but since no one else has suggested this yet, and it doesn't have an (explicit) nested loop:
>>> lol = [[1,2,3],[4,40],[10,20,30]] >>> >>> for l in lol: ... if max(l) > 30: ... continue ... print l ... [1, 2, 3] [10, 20, 30]