Jan-14-2019, 11:35 PM
+1 to nilamo requesting the whole error, but I felt generous and ran the code:
Error:Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 9, in deepconcat
File "<stdin>", line 11, in deepconcat
File "<stdin>", line 9, in deepconcat
File "<stdin>", line 9, in deepconcat
File "<stdin>", line 9, in deepconcat
File "<stdin>", line 11, in deepconcat
File "<stdin>", line 9, in deepconcat
File "<stdin>", line 11, in deepconcat
File "<stdin>", line 9, in deepconcat
File "<stdin>", line 9, in deepconcat
File "<stdin>", line 9, in deepconcat
TypeError: can only concatenate str (not "list") to str
When I started digging into your code I realized that you're returning within a loop such that the loops is misleading, you only ever look at the first element (for input composed only of strings and lists). I would suggest that you either (1) get rid of that loop or (2) make the loop not return on the first iteration. I think once you do that that your code will be more clear and easier for you and us to debug.