'Reverse string using recursion with new character between each letter in string

I am trying to create a script to reverse the order of a string and put a new character between each letter of the string. For example, let's say I have the word Difficulty, I would like it to be reversed, and a new character, such as a hyphen, added between each character.

Input: "Difficulty"

Output: "y-t-l-u-c-i-f-f-i-D"

The code I am I came up with adds an extra asterisk at the start of the script:

def try_reverse(s):
    if s == "":
        return s
    else:
        return try_reverse(s[1:]) +"-" + s[0]

Output: "-y-t-l-u-c-i-f-f-i-D"

The only catch is that it needs to be done as a recursion.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source