mardi 3 mars 2015

Python Sum of nested list with str items

Given: [[[[[[[[['A']]]]],[[[[['B']]]]],['C'],[[[[['D']]]]]]


Or something like that. A complicated nested list.


How can I return either: 'ABCD' or ['ABCD']


Recursive function with int is simple enough due to the sum helper function, but I can't imagine how to do this with str. Thanks for your help!


Aucun commentaire:

Enregistrer un commentaire