Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems 22nd European Conference Adbis 2018 Budapest Hungary September 2 5 2018 Proceedings Lncs 11019

Authors: Andras Benczur ,Bernhard Thalheim ,Tomas Horvath

1st Edition

3319983970, 978-3319983974

More Books

Students also viewed these Databases questions

Question

9. Mohawk Industries Inc.

Answered: 1 week ago

Question

8. Satyam Computer Services Limited

Answered: 1 week ago