Preliminary
- Due Date: Friday, January 26 by 12:45
- This is an individual assignment.
Counting Vowels - 100 points
In this assignment, you will use your knowledge of Python strings and recursion to write functions that count the number of vowels in a string.
Assignment
- Download vowels.py
- Replace the body of the
count_vowelsfunction such that it returns the number of vowels in the supplied sentence using the built-incount()method. The function must assume that the supplied string contains uppercase and lowercase letters. - Replace the body of the
count_vowels_iterativefunction such that it returns the number of vowels in the supplied sentence using a for loop. The function must assume that the supplied string contains uppercase and lowercase letters. - Replace the body of the
count_vowels_recursionfunction such that it returns the number of vowels in the supplied sentence using recursion. The function must assume that the supplied string contains uppercase and lowercase letters.
Assumption
- Consider the following letters only to be vowels: a, e, i, o and u (and not A, E, I, O, U, Y, or y).
Requirements and Grading
- 30 points - The
count_vowelsfunction is correctly implemented. - 30 points - The
count_vowels_iterativefunction is correctly implemented. - 40 points - The
count_vowels_recursivefunction is correctly implemented.
Submission
Place the solution in a file named vowels_[firstname].py and submit it in the Portal no later than 12:45 PM on Friday, January 26.