Question: Python3 Write a function find_words() that takes one input parameter, input_string, which is of the type str and it contains a sentence. A sentence is
Python3

Write a function find_words() that takes one input parameter, input_string, which is of the type str and it contains a sentence. A sentence is a series of words separated by spaces. Your function will have to split this string on spaces to form a list of words called all_words. Then, return a new list, selective_words, that contain only those words whose length is greater than or equal to 4. For example: >>>print (find_words( Today is a bright and sunny day") [Today', bright, 'sunnyl >>print (find_words( Twinkle twinkle little star") ['Twinkle', twinkle', "little', 'star] >>>print (find_words("I am young, wild, and free.") 'young, 'wild,', free.] >>>print (find_words("I am in my car)) [l Hint: Use split() to split the given input_string into words and append() to add new item to a list For example: Test Result print (find_wordsC Today is a bright and sunny day" print (find_words("Twinkle twinkle little star")) print (find wordsC"I am young, wild, and free." C'Today 'bright', sunny' C'Twinkle', 'twinkle, 'little', 'star ] ['young, ', 'wild,', 'free. ']
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
