- 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.

4 Answers

+ 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)

+ 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đ

+ 1

Have a look at the itertools module

+ 1

Sure!