Question: Expected Behavior Write a function words_ending_with (wordlist, tail) that behaves as follows. The argument wordlist is a list of strings, while the argument tail is

Expected Behavior

Write a function words_ending_with(wordlist, tail) that behaves as follows. The argument wordlist is a list of strings, while the argument tail is a string. words_ending_with(wordlist, tail) returns a list consisting of those strings in wordlistthat end with tail. If none of the strings in wordlist end with tail, it returns the empty list.

The order of list elements in the list returned by the function should match the order of their occurrence in wordlist.

Examples

In the examples below, wordlist is the list

['evolve', 'absolve', 'crow', 'spoke', 'truck', 'lake', 'wow', 'wave'] 

words_ending_with(wordlist, 'ow') Return value: ['crow', 'wow']

words_ending_with(wordlist, 'lve') Return value: ['evolve', 'absolve']

words_ending_with(wordlist, 'e') Return value: ['evolve', 'absolve', 'spoke', 'lake', 'wave']

words_ending_with(wordlist, 'ke') Return value: ['spoke', 'lake']

words_ending_with(wordlist, 'ing') Return value: []

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!