[Python] Permutation of list in python with one or multiple fixed items

Discussão em 'Python' iniciado por Stack, Setembro 3, 2025.

  1. Stack

    Stack Membro Participativo

    I have a list of a = [1,2,3,4] I want all the possible permutations, if I need to fix an entry I should be able to do that.

    e.g. If I want to fix third element then the 3 should remain there, if want to fix 3 and 4 then and four remain at their place and rest all change.

    I want to write a function that takes two inputs, first is a list and the second one the locations that i want to keep fixed.

    I also don't want to have repetitions.

    Can someone please help me write this function.

    Continue reading...

Compartilhe esta Página