0

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

and so on please help

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

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

0

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

1

Combinations, permutations etc can be found in itertools module.

Edited by pyTony

0

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))
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.