Levels Tought:
Elementary,Middle School,High School,College,University,PHD
Teaching Since: | Apr 2017 |
Last Sign in: | 10 Weeks Ago, 4 Days Ago |
Questions Answered: | 4870 |
Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
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="Applenpear 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']
-----------