- Write a function called
multBy(nums, n) (where nums is a list of numbers and n is a number) that returns a new list containing each number from nums multiplied by n.
>>> multBy([5, -3, 2], 3)
[15, -9, 6]
- Write a function called
lowerCase(words) (where words is a list of strings) that returns a new list containing each word from the original list converted to lower case.
>>> lowerCase(['GIANT', 'College', 'comPuter'])
['giant', 'college', 'computer']
- Write a function called
initialVowel(words) (where words is a list of strings) that returns a new list of all of those strings that start with a vowel.
>>> initialVowel(['any', 'every', 'none', 'some', 'About'])
['any', 'every', 'About']
- Write a function called
pastWords(words) (where words is a list of strings) that returns a new list of all of those strings that end with "ed".
>>> pastWords(['helped', 'educate', 'replaced', 'asked', 'talking'])
['helped', 'replaced', 'asked']
- Write a function called
workable(words) (where words is a list of strings) that returns a new list of all of those strings that contain the substring "work".
>>> workable(['spark', 'rework', 'target', 'working', 'unworkable'])
['rework', 'working', 'unworkable']
- Write a function called
longPhrases(phrases, n) (where phrases is a list of strings) that returns a new list of all of those strings that contain n or more distinct words.
>>> longPhrases(['Star Wars', 'The Empire Strikes Back', 'Raiders of the Lost Ark', 'Titanic', 'The Terminator'], 4)
['The Empire Strikes Back', 'Raiders of the Lost Ark']
- Write a function called
squares(nums) (where nums is a list of numbers) that returns a dictionary mapping each number to its square.
>>> squares([5, 2, -3])
{2: 4, 5: 25, -3: 9}