Hi,
I spent quite a long time looking for answers in previous topics but can only partly answer my question so far. I have two goals:
(1) First, i want to shuffle two variables. Let’s call them A (e.g. blue, red, yellow, green ) and B (e.g. dog, cat, bird, fish…). I want my participants to see random associations between A and B, and not only the classic row display (blue-dog; red-car; yellow-bird…).
(2) I also want to randomly divide my variables in two equally long lists. A and B both currently have 40 items, I want to show 20 A items and 20 B items in a first bloc, then 20 A items and 20 B items in a second bloc. Importantly, no items should be repeated twice, if it appears in bloc 1 it doesnt in bloc 2 and vice-versa.
With the following code, I can solve point (2): I make two randoms, 20 items long lists, and present them in two different blocs.
import random
vector = list(range(40))
RowsLoop1 = random.sample(vector, 20)
remaining_vector = list(set(vector) - set(RowsLoop1))
RowsLoop2 = random.sample(remaining_vector, 20)
But I can’t figure out point (1): how to previsouly shufle items within their respective condition?
Thanks for reading, any help will be much appreciated!