sorry this has undoubtably been asked but I can't seem to find it. I'm wanting to return a list from a list in python however when I try to do it, it seems to return the list as a string so will always access the first if statement.
x = entryList.index(0)
if type(x) is list:
if type(x) is str:
combined_str = ""
for x in entryList:
combined_str += x
print(multpoly(["1", "2", "3"]))
def multipoly(l): #l not list x = l if isinstance(x, str): return ''.join(l) elif isinstance(x, list): return [a for sublist in l for a in sublist] else: raise ValueError("Not a list of strings or list of lists")
isinstance to check types. Don't use names that already have meanings, like