Dfine a function wordswithletter that takes 2 parameters


Problem 1.

Define a function wordsWithLetter() that takes 2 parameters:

1. text, a string containing words and white spaces

2. letter, a string of length 1

The function returns the total number of words in text containing letter.

for example,

>>>line='It is what it is'

>>>print(wordsWithLetter(line,'i'))

>>>4

Problem 2. Define a function lineStats() that takes one parameter:

1. paragraph, a string of words and white spaces

The function returns a list containing the number of vowels in each line.

for example,

>>>t="Apple\npear and kiwi"

>>>print(lineStats(t))

>>>[2,5]

Problem 3.

Define a function wordsStats() that takes one parameter:

1. text, a string of words and white spaces

The function returns a list of unique words in text.

HINT: The words 'IT' and 'it' are the same.

For example,

>>>print(wordsStats('It is what it is'))

>>>['it','is','what']

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Dfine a function wordswithletter that takes 2 parameters
Reference No:- TGS02897319

Expected delivery within 24 Hours