Рекурсивные перестановки Python

У меня возникли проблемы при попытке сделать код перестановки с рекурсией. Предполагается, что можно вернуть список к использованию со всеми возможными позициями для каждой буквы. так за словоcat это должно вернуться['cat','act',atc,'cta','tca','tac'] , пока у меня есть это

def permutations(s):
    lst=[]
    if len(s) == 1 or len(s) == 0 :
        # Return a list containing the string, not the string
        return [s]
    # Call permutations to get the permutations that don't include the
    # first character of s
    plst = permutations(s[1:])
    print(plst)
    for item in plst:
        print (item)
        plst= permutations(s[1+1:])

         # Now move through each possible position of the first character
        # and create a new string that puts that character into the strings
        # in plst
        for i in range(len(s)):
            pass
            # Create a new string out of item
            # and put it into lst
        # Modify
    for item in lst:
        print(index)

Там есть шаги, но я не уверен, как их использовать

Ответы на вопрос(7)

Ваш ответ на вопрос