I'm struggling with a problem that seems so basic and yet drives me crazy as I'm still unable to implement.
Here's the deal: I have a list with 5 elements, for instance :
['A', 'B', 'C', 'D', 'E']
I want the elements in the lists so that each list contains the same element at differents indexes. So for example, the element 'A' will have a different index position in each list. It should be randomize so that each time I run the code, I still have different lists.
like this:
['A', 'B', 'C', 'D', 'E']
['C', 'D', 'E', 'A', 'B']
['B', 'C', 'D', 'E', 'A']
['E', 'A', 'B', 'C', 'D']
['D', 'E', 'A', 'B', 'C']
I tried with itertools, I tried with if statement into for loops into for loops but obviously it didn't work... I feel like the solution is very simple but I'm missing something.
You can change the code according to how many lists you want.