In Exercises 25 through 30 determine the value of list2 wher

In Exercises 25 through 30, determine the value of list2, where list1= [\"democratic\", \"sequoia\", \"equals\", \"brrr\", \"break\", \"two\"]. 25. list2 = [len (word) for word in list!] 26. list2 = [word. capitalize() for word in list!] 27. list2 = [word, upper() for word in list! if len (word) 3], where number- OfVowels is the function defined in Example 6. OfVowels is the function defined in Example 6.

Solution

Here is the solution to all the problems:


list1 = [\"democratic\", \"sequoia\", \"equals\", \"brrr\", \"break\", \"two\"]
list2 = [len(word) for word in list1]  
#For each word the length of the word is stored in list2.
#Its a list of integers. And the list2 will be: [10, 7, 6, 4, 5, 3].

list2 = [word.capitalize() for word in list1]
#For every word in the list list1, the first character will be capitalized, and stored in list2.
#And the list2 will be: [\'Democratic\', \'Sequoia\', \'Equals\', \'Brrr\', \'Break\', \'Two\']

list2 = [word.upper() for word in list1 if len(word) < 5]
#For each word in the list list1, all characters in the string will be converted to uppercase,
#and stored in list2 only if the the number of characters in the word is less than 5.
#And the list2 will be: [\'BRRR\', \'TWO\']

list2 = [word for word in list1 if numberOfVowels(word) > 3]
#For each word in list1, if the number of vowels is grater than 3, it is added to the list2.
#democratic has the vowels e, o, a, and i, so is added to list2.
#sequoia has the vowels e, u, o, i, and a, so is added to list2.
#equals has the vowels e, u, and a, so is not added to list2.
#brrr has no vowels, so is not added to list2.
#break has vowels e, and a, so is not added to list2.
#two has vowels o, so is not added to list2.
#Finally, list2 will be: [\'democratic\', \'sequoia\']

 In Exercises 25 through 30, determine the value of list2, where list1= [\

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site