I have a string, I want to split it into a list so that every element of the list has N words. If the last element does not have enough words, leave it as it is.
for example:
>>> Split_by_N_words(string="I grow a turtle. It's a very slow but cute animal.", N=4)
["I grow a turtle.", "It's a very slow", "but cute animal."]
I tried to do this:
def Split_by_N_words(string, N):
word_list = [""]
for a in string.split()[:N]:
word_list[0] += a + " "
.....
But I have no idea how to proceed with the other elements