0
Example: A B C D 4 elements result: WITH TWO ELEMENTS AB AC AD BC BD CD
WITH THREE ELEMENTS ABC ABD RCA BCD
0
Example: A B C D 4 elements result: WITH TWO ELEMENTS AB AC AD BC BD CD
WITH THREE ELEMENTS ABC ABD RCA BCD
1
Here it is:
from itertools import permutations
import re
caracteres = ['A', 'B', 'C', 'D']
for i in permutations(caracteres,2): # 2 elementos
i = re.sub(r'\W',"",str(i)) # Retirando outros caracteres que não sejam letras
print(i)
print()
for i in permutations(caracteres,3): # 3 Elementos
i = re.sub(r'\W',"",str(i))
print(i)
print()
for i in permutations(caracteres,4): # 4 Elementos
i = re.sub(r'\W',"",str(i))
print(i)
Browser other questions tagged python combinations
You are not signed in. Login or sign up in order to post.
Thank you very much Antony,
– Armando A. Mendes
I made a change from permutations to Combinations and resulted in what I needed!
– Armando A. Mendes
How I would make the object-character collection and cluster size required for the user to type?
– Armando A. Mendes