I need to split all the words of a string in a list. I know that the code below is wrong, but I've only managed to do this.
def split_sentence(sentence):
new_list = []
for i in sentence:
new_list.append(i)
return new_list
print(split_sentence("This is a test"))
output :
['T', 'h', 'i', 's', ' ', 'i', 's', ' ', 'a', ' ', 't', 'e', 's', 't']
wanted output:
['This', 'is', 'a', 'test']