Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

def charWordList(wordList, char): - charWordList takes the parameter wordList the parameter char, and returns a list of all the strings that contain char. - If

image text in transcribedimage text in transcribed

def charWordList(wordList, char): - charWordList takes the parameter wordList the parameter char, and returns a list of all the strings that contain char. - If wordList is not a list type, or if char is not a string type, the function should return None. - If elements in wordList are not strings, those elements should just be ignored. - Note: When char is of type string, it will be of length 1. For example, char will be a single letter like "a" or "z. We will not test for cases where char is more than one character, like char = "ab - ***Hint: you will need to use a while loop, list indexing, and a call to your previous function. Once again, you may not use the in operator*** - ***Make sure to use charInWord function that you previously wrote: it is your helper function. *** return "stub" from labo3 import charWordList # Test cases for charWordList: def test_charWordList_1(): assert charwordList(["dog", "cat", "fish","wolf", "rabbit", "donkey"], "o") == ["dog", "wolf", "donkey"] def test_charWordList_2(): assert charWordList(["", 8, True, "groot", "grout"], "u") == ["grout"] def test_charWordList_3(): assert charWordList([""], "o") == [] def test_charWordList_4(): assert charWordList(["", 8, True, "groot", "grout"], True) == None

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

Students also viewed these Databases questions

Question

Why are ratios and trends used in financial analysis?

Answered: 1 week ago