You are viewing a single comment's thread. Return to all comments →
from itertools import product l = [x,y,z] y = [] for i in range(max(l) + 1): y.append(i) m = list(product(y,repeat = 3)) k = [i for i in m if i[0] <= l[0] and i[1] <= l[1] and i[2] <= l[2] and sum(i) != n] p = [] for j in k: if j not in p and list(j) not in p: p.append(list(j)) print(p)
Seems like cookies are disabled on this browser, please enable them to open this website
List Comprehensions
You are viewing a single comment's thread. Return to all comments →