-5

For example: [0,1,2,3] expected results [0,1], [0,2], [0,3], [1,2], [1,3], [2,3]

Bassem Samir
  • 114
  • 9

1 Answers1

0

Use combinations from itertools

 from itertools import combinations
 x = combinations(lst,2)

https://docs.python.org/2/library/itertools.html#itertools.combinations

C Haworth
  • 659
  • 3
  • 12