This is my list:
lst = [1,2,3,4,5]
If I do this:
from itertools import permutations
lst = [1,2,3,4,5]
l = []
lperm = permutations(lst,3)
for i in lperm:
l.append(i)
print(l)
It returns this:
[(1, 2, 3), (1, 2, 4), (1, 2, 5), (1, 3, 2), ...]
But this is what I want:
[(1, 2, 3),(2, 3, 4),(3, 4, 5)]
Anyone has an answer for this?