I have a list that looks like:
A
B
C
D
E
F
G
How do I solve this to find all combinations for 3 digits. The same letter cannot be used in
combinations works on strings not lists, so you should first turn it into a string using: ''.join(x)
from itertools import combinations
x = ['a', 'b', 'c', 'd', 'e']
n = 3
aa = combinations(''.join(x), n)
for comb in aa:
print(''.join(comb))
OUTPUT
abc
abd
abe
acd
ace
ade
bcd
bce
bde
cde
Or as a one-liner:
[''.join(comb) for comb in combinations(''.join(x), n)]