In the following cell, we've loaded the text of Pride and Prejudice by Jane Austen, split it into individual words, and stored these words in an array p_and_p_words. Using a for loop, assign longer_than_five to the number of words in the novel that are more than 5 letters long. Hint: You can find the number of letters in a word with the len function.

Respuesta :

Answer:

Explanation:

Since the array is not provided, I created a Python function that takes in the array and loops through it counting all of the words that are longer than 5. Then it returns the variable longer_than_five. To test this function I created an array of words based on the synapse of Pride and Prejudice. The output can be seen in the attached picture below.

def countWords(p_and_p_words):

   longer_than_five = 0

   for word in p_and_p_words:

       if len(word) > 5:

           longer_than_five += 1

   return longer_than_five

Ver imagen sandlee09