Question: SOLVE USING PYTHON Question 13 We define the letters 'a', 'e', 'i', 'o' and 'u' as vowels. We do not consider any other letter as

SOLVE USING PYTHON

Question 13

We define the letters 'a', 'e', 'i', 'o' and 'u' as vowels. We do not consider any other letter as a vowel.

Write a function named initialVowels() that returns a list of words in a body of text that begin with a vowel.

Include both capitalized and lower case instances of the vowels.

A word should appear in the return list at most once, no matter how many times is occurs in the input string.

Input: a string that consists of words, separated by spaces

Return: an list of words in the input string that begin with an upper or lower case vowel

For example, the following would be correct output:

>>> mlk = 'Our lives begin to end the day we become silent about things that matter'

>>> print(initialVowels(mlk))

['Our','about']

Question 14

The three words 'a', 'an' and 'the' are the only articles in the English language.

Write a function named countArticles(). Hint: Count both capitalized and lower case instances of articles.

Input: a string, named sentence

Return: the number of words in sentence that are articles

For example, the following would be correct output:

>>> theFlea = ['The flea is a mighty insect']

>>> print(articleCount(theFlea))

>>> 2

Question 15

Write a function named pluralCount() that takes two string parameters.

The first parameter is the name of an input file that exists before pluralCount() is called.

The second parameter is the name of an output file that pluralCount() creates and writes to.

You may assume that the input file is in the current working directory and you should write the output file to that directory as well.

For each line in the input file, the function pluralCount() should write to the output file the number of words in the line that end in the letter 's'.

For example, if the following is the content of the file foxInSocks.txt:

Look, sir. Look, sir. Mr. Knox, sir.

Let's do tricks with bricks and blocks, sir.

Let's do tricks with chicks and clocks, sir.

The following function call:

inF = 'foxInSocks.txt'

outF = 'foxRepLines.txt'

pluralCount(inF, outF)

should create the file foxRepLines.txt with the content:

0

4

4

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!