[Python] Python permutations of x unique characters repeated y times each

Discussão em 'Python' iniciado por Stack, Fevereiro 6, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to get a list of permutations of x unique characters repeated y times each. So that would look something like this:

    x = ['0', '1']
    y = 2

    permutation_list = ['0011','0101','1001','1010','0110','1100']


    I don't want extra stuff ('0001', '1110', etc) and I don't want duplicates - does anyone know of a neat way to do this?

    I've tried using itertools but I end up with duplicates.

    Continue reading...

Compartilhe esta Página