Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3. Write a function called findShorterStrings() that accepts a list of strings and a length. The function should return a list that contains only those

image text in transcribed
3. Write a function called findShorterStrings() that accepts a list of strings and a length. The function should return a list that contains only those strings that are shorter than the length specified. For example: sports = ['hockey', 'scuba diving', 'baseball', 'football', 'table tennis', 'cricket'] words = ['hello', 'collective', 'bicycle','car', 'catalog', 'resources' print (findShorterStrings (sports,10)) #should output the list: ['hockey', 'baseball', 'football', 'cricket'] print (findShorterStrings (sports,5)) #should output an empty list: [] #since there are no items in the list shorter than 5 characters print (findShorterStrings (words, 4)) #should output the list ['car'] Hints: You should create a new, empty list inside your function. Remember that you can add items to a list using the append() function

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing

Authors: David M. Kroenke

12th Edition International Edition

1292023422, 978-1292023427

More Books

Students also viewed these Databases questions

Question

2. What potential barriers would you encourage Samuel to avoid?

Answered: 1 week ago