Question: def select_sentences(sentences, condition): result = [sent for sent in sentences if len(sent.split()) > condition] return(result) sentences = ['My mom taught me to finish everything on
def select_sentences(sentences, condition): result = [sent for sent in sentences if len(sent.split()) > condition] return(result) sentences = ['My mom taught me to finish everything on my plate at dinner.',\ 'The only problem with a pencil during school, is that they do not stay sharp long enough.',\ 'Our school building is made of bricks.',\ 'Every weeknight I get woken up by the sound of a barking dog across the street before school.',\ 'Salad is for rabbits.'] condition = 7 # print sentences whose length is greater than 7 words # calling the function select_sentences(sentences, condition)
Use the function select_sentences you defined above to select all sentences that have the word "school" or "is".
Define the necessary condition in Python (below).
# 1. Write code that defines the necessary condition for this problem here
...
... # 2. Write code that uses this condition to select the sentences as described above.
...
... # 3. Write code to print out these selected sentences
...
...
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
