I want to merge element in the list based on given start and stop index of tuple (non-overlap for tuple). I\'ll leave the indices that don\'t mention as it is. This is my ex
For the fun of it, because I've been learning Haskell, a recursive solution:
def recursive(ls, merge): if merge == []: return ls else: x, xs = merge[0], merge[1:] return ls[:x[0]] + [''.join(ls[x[0]:x[1]])] + recursive(ls, xs)[x[1]:]
Only works if there are no overlapping intervals, however.