I have a list of sentences like:
lst = ['A B C D','E F G H I J','K L M N']
What i did is
l = []
for i in lst:
for j in i.split():
print(j)
l.append(j)
first = l[::2]
second = l[1::2]
[m+' '+str(n) for m,n in zip(first,second)]
The Output i got is
lst = ['A B', 'C D', 'E F', 'G H', 'I J', 'K L', 'M N']
The Output i want is:
lst = ['A B', 'B C','C D','E F','F G','G H','H I','I J','K L','L M','M N']
I am struggling to think how to achieve this.
[i for x in map(lambda x: x.split(' '), lst) for i in map(' '.join, zip(x[:-1], x[1:]))]::2with:in both places