The problem is such:
I have a series of lists
, always containing two items
. Each of these items
can be either a string
or another list. The goal is to figure out how to make all these items
from lists
appear in a single resultant_list
, and return that resultant_list
.
My code so far looks like (where nest is the list to be stripped):
def strip(nest):
result_list=[]
for item in nest:
if type(item) is str:
result_list.append(item)
else:
return result_list + strip(item)
Where am I going wrong here?