Your information is already stored in the list
Maybe something like this?
variables
. I wouldn't move the data to other names. Maybe something like this?
from itertools import product from more_itertools import grouper import string # create the "data" number_pairs = 3 variables = list(string.ascii_uppercase[:number_pairs * 2]) print(f"variables data starts as {variables}") number = len(variables) groups = grouper(variables, 2) finallist = product(*groups) print(list(finallist))
Output:variables data starts as ['A', 'B', 'C', 'D', 'E', 'F']
[('A', 'C', 'E'), ('A', 'C', 'F'), ('A', 'D', 'E'), ('A', 'D', 'F'), ('B', 'C', 'E'), ('B', 'C', 'F'), ('B', 'D', 'E'), ('B', 'D', 'F')]
Change number_pairs
make a bigger list, and the the product is created from whatever is in the list.