hii

I have a list having m1 m2 m3........ m922

and in each there are a1 a2 a3 a4 are there like
m1=a1 a2 a3 a4 a5 a6
m2=a1 a2 a3 a4 a5 a6
m3=a1 a3 a5 a7 a8 a2

etc

and i want this as

m1=a1 a2 a3 a4 a5 a6
a2 a3 a4 a5 a6 a1
a3 a1 a2 a4 a5 a6
a4 a1 a2 a3 a5 a6
m2 =a1 a2 a3 a4 a5 a6
a2 a3 a4 a5 a6 a1
a3 a1 a2 a4 a5 a6
a4 a1 a2 a3 a5 a6

4
Contributors
4
Replies
34
Views
3 Years
Discussion Span
Last Post by sneekula

It is very difficult to understand how the expected output is connected to the input. Can you explain this ? Also why did you post this in four different forums (python, java, C, C++)? What do you want exactly ?

Edited by Gribouillis

i just wanted it to be done bro...... i am not good with programming and output is just all possible combinations of input

Combinations, permutations etc can be found in itertools module.

Edited by pyTony

For example:

``````import itertools

s = "a1 a2 a3 a4 a5 a6"
seq = s.split()
print(seq)  # test

for e in itertools.permutations(seq):
print(" ".join(e))
``````