Jun-11-2020, 02:33 PM
I'm curious to hear from some of the more experienced coders on the forum what they think is the best way to do this. I understand that it's generally considered desirable to avoid using
Here is what I came up with:
range(len(sequence))
, but I'm having a hard time doing so without adding lines of code or checks I wouldn't need otherwise.Here is what I came up with:
l = ['a', 'b', 'c', 'd'] newl = [] for i in range(len(l) -1): newl.append(''.join(l[i] + l[i+1])) print(newl)