Sep-11-2019, 07:29 AM
(Sep-11-2019, 07:20 AM)3Pinter Wrote: It does leave out the 'themselves'-ones but not the duplicate matches.
In my case [1,6] will return the same result (if doing a function) as [6,1]
I think I found a way:
listA = [1,2,3,4,5,6] listB = listA[:] output = [] for a in listA: for b in listB: if b != a and b > a: # function here output.append([a,b]) print(output)and that little modification produces the following output:
Output:[[1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [2, 3], [2, 4], [2, 5], [2, 6], [3, 4], [3, 5], [3, 6], [4, 5], [4, 6], [5, 6]]
All the best,
newbieAuggie2019
"That's been one of my mantras - focus and simplicity. Simple can be harder than complex: You have to work hard to get your thinking clean to make it simple. But it's worth it in the end because once you get there, you can move mountains."
Steve Jobs
"That's been one of my mantras - focus and simplicity. Simple can be harder than complex: You have to work hard to get your thinking clean to make it simple. But it's worth it in the end because once you get there, you can move mountains."
Steve Jobs