Question: This is my recursive function for the above problem. Is this recursive function? If not, how can I fix it? def duplicate(word, count): str_list =

This is my recursive function for the above problem. Is this recursive function? If not, how can I fix it?
def duplicate(word, count): str_list = [] for s in word: c = [s]*count str_list.extend(c) return "".join(str_list)
Part III: Duplicating Letters (2 points) Write a recursive function duplicate that takes a non-empty string and a positive integer as its arguments, and returns a new string in which each letter of the original string has been duplicated the given number of times. The examples below will help to further clarify what the function is supposed to do. Your function must be recursive and must not use any loops. Examples: Function Call Return Value duplicate abcd', 3) aaabbbcccddd duplicate Stony 1) Stony duplicate moonmoon' 2) mmoooonnmmoooonn
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
