KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have the two following lists: l1 = [1, 2, ,3] l2 = [x, y] And would like to have all lists of 5 elements keeping the order of l1 only. Say: [x, y, 1, 2, 3], [x, 1, y, 2, 3], [x, 1, 2, y, 3], [x, 1, 2, 3, y], [y, x, 1, 2, 3], [y, 1, x, 2, 3], [y, 1, 2, x, 3], [y, 1, 2, 3, x], [1, x, y, 2, 3], [1, x, 2, y, 3], [1, x, 2, 3, y], [1, y, x, 2, 3], [1, y, 2, x, 3], [1, y, 2, 3, x], ... [1, 2, 3, y, x], ... [1, 2, 3, x, y] Observe that the order of l1 is important and l2 is not. l2 elements run over l1+l2 positions but only the order of l1 is important. I'm struggling with this. Any help is appreciated.
Tags (comma-separated)
Save Edits
Cancel