Greeting from a real newbie,

I think that their might exist an easy way, in Python, for my list
permutation issue. I need to be able to permute all elements from across
several lists, while ensuring order is maintained across the lists.

For example: list1=[a b]   list2=[c d e]  list3=[f]  list4=[g h]

permute(list1, list2, list3, list4) =

[ [a c f g], [a c f h], [a d f g], [a d f h], [a e f g], [a e f h],
  [b c f g], [b c f h], [b d f g], [b d f h], [b e f g], [b e f h] ]

Of course, the number of the lists is arbitrary and the size of each list is
also arbitrary.

Any help would be greatly appreciated.

thanks,
Bertha
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to