The following works but I’m wondering if there is a better more Pythonic way. I’m checking if there is any list in
crosses that has all different numbers than any list in
crosses then check
crosses, then check
crosses, and so on. The list might be much longer I just used a short one for example.
The lists that do not share any of the same numbers are:
crosses and crosses, crosses and crosses, crosses and crosses
crosses = [[[1,2,3,4], [2,3,4]], [[1,6,7,8], [2,6,7,8]], [[1,2], [6,7]]] result = 0 for i in range(len(crosses)): for j in range(len(crosses[i])): for k in range(i + 1, len(crosses)): for l in range(len(crosses[k])): match = False for num in crosses[i][j]: if num in crosses[k][l]: match = True if not match: area = len(crosses[i][j]) * len(crosses[k][l]) if area > result: result = area print(result) # 12