Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • 60
    you can just list it all. list(itertools.combinations(iterable, r)) Commented Sep 14, 2017 at 12:23
  • 29
    is there anything that does not require r, i.e. combinations of any length subsequences of elements. Commented May 23, 2020 at 5:39
  • 5
    this is very good and pointed me to what really solved my problem, which was itertools.combination_with_replacement. Commented Oct 15, 2020 at 23:39
  • 3
    the function writes intertools.combinations_with_replacement Commented Sep 3, 2021 at 17:53