- 1

Is this permutation possible with python

I want to run permutation for a list of 45 number...Then the resul will be in lists but have only 5 values in each until all 45 numbers are covered. ....Please, how do i do this....If its possible.

27th Apr 2020, 9:52 PM
Knowledge Akoma
Knowledge Akoma - avatar
4 Réponses
+ 1
numgroup = [] maingroup = [] numlist = [x for x in range(1, 46)] for x in numlist: numgroup.append(x) if len(numgroup) == 5: maingroup.append(list(numgroup)) numgroup.clear() print(maingroup)
27th Apr 2020, 11:11 PM
rodwynnejones
rodwynnejones - avatar
+ 1
thanks a lot!...Though it's still not as i hoped...It olny shared it into groups with 5 values each...I needed it all permutated and shared this way. But i think i have an idea.Thanks to you👌
28th Apr 2020, 8:20 PM
Knowledge Akoma
Knowledge Akoma - avatar
+ 1
Have a look at the itertools module
28th Apr 2020, 10:44 PM
rodwynnejones
rodwynnejones - avatar
+ 1
Sure!
28th Apr 2020, 11:03 PM
Knowledge Akoma
Knowledge Akoma - avatar