'Write a recursive function that copies some characters from start of each word in the parameter list to create a new string

I want to write a function using recursion that copies the first character from the first word in the list, 2 characters from second word and so on.

Here is what I wrote:

def word(words_list, i):
    if len(words_list[i]) <= 1:
        return words_list[i]
    else:
        return words_list[i][0] + get_code(words_list[i][1:],i)
    i += 1

>>>print(word(["tigers", "zebras", "and", "lions"], 0))
tzeandlion # Expected
ti # received

How can I go about this? Any help pls?



Sources

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

Source: Stack Overflow

Solution Source