Is there any faster approach to split elements in a list and also include the split element. If an element is a word, there is no need to add the split elements again. My current working solution is below and just want an improvement if any
final_list = []
lists = ["the", "I am there", "call me"]
for l in lists:
splitted_l = l.split()
if len(splitted_l) == 1:
final_list.append(splitted_l)
else:
splitted_l.append(l)
final_list.append(splitted_l)
print(final_list)
---------
output = [['the'], ['I', 'am', 'there', 'I am there'], ['call', 'me', 'call me']]