Oct-19-2020, 11:31 PM
>>> [(xitem, yitem) for xitem in x for yitem in y if xitem * yitem < 10] [(1, 5), (1, 3.33), (1, 2.5), (1, 2), (2, 3.33), (2, 2.5), (2, 2), (3, 3.33), (3, 2.5), (3, 2), (4, 2)]Or if you didn't want to roll the loop yourself, you could use product and operator modules...
>>> from itertools import product >>> from operator import mul >>> [p for p in product(x,y) if mul(*p) < 10] [(1, 5), (1, 3.33), (1, 2.5), (1, 2), (2, 3.33), (2, 2.5), (2, 2), (3, 3.33), (3, 2.5), (3, 2), (4, 2)]