Question: Write a recursive function extractStr () that takes an arbitrarily nested list as a parameter and returns a string that consists of the concatenation of

Write a recursive function extractStr() that takes an arbitrarily nested list as a parameter and returns a string that consists of the concatenation of all strings found in the list. Note that the list may contain any Python type, not just strings. Recall that you can determine whether an item is a string by writing type(item) == str and whether an item is a list by writing type(item) == list. The function should not use any loops. The only list functions you are allowed to use are len(), indexing (lst[i] for an integer i), or slicing (lst[i:j] for integers i and j). You should use string concatenation in writing your solution. If the list does not contain any strings or is empty the function should return the empty string. The following shows several sample runs of the completed function: NO LOOPS OF ANY SORT SINCE ITS A RECURSIVE FUNCTION.

This is the output and in python, please

Write a recursive function extractStr() that takes an arbitrarily nested list as

Python 3.6.4 Shell File Edit Shel Debug Options Window Help >>s extractStr ([]) > S actStr ( [ [ [ ' one' ] ' two' ] , 3] ) >>> s = extr 3 onetwo' , extractStr (Pene . ttttt two three , 4, s.s, si#1) 3 'onetwothreesix' > S two threes ix' a - extractStr(t1.s, tttttEwo'11111, 'three', > S twothreesixseven' s-extractstr(lttj, 2], 3.5]) 3 Ln: 76 Col: 4

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!