Question: How to create a recursive function in python 3: add, that consumes a list and a string, and returns the list with the string added

How to create a recursive function in python 3:

add, that consumes a list and a string, and returns the list with the string added to each of the list elements:

for example,

s = ["one", "two"]

add( s, "addthis")

returns:

[ "oneaddthis", "twoaddthis"]

Thanks in advance:)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!