I want my Python function to split a sentence (input) and store each word in a list. My current code splits the sentence, but does not store the words as a list. How do I do that?
def split_line(text):
# split the text
words = text.split()
# for each word in the line:
for word in words:
# print the word
print(words)
print(word)
as your last line. – tgray