python form all possible combinations of groups of 2, 3, 4 from a list when the length of groups is known

前端 未结 0 2019
南方客
南方客 2021-02-06 22:16

Suppose I have tuple like 1,2,3,4,5.

I want to group it like 1,1,0 that is (1 group of 2), (1 group of 3) and (0 groups of 4).

The result

相关标签:
回答
  • 消灭零回复
提交回复
热议问题