https://thestudycorp.com/wp-content/uploads/2020/02/imageedit_1_2977755019.png 0 0 https://thestudycorp.com/wp-content/uploads/2020/02/imageedit_1_2977755019.png 2020-10-21 20:12:372020-10-21 20:12:37Lab 3: Ventriloquism: Strings, Iteration and Recursion Assignments
I don’t understand this Python question and need help to study.
- Download ventriloquism.py, below.
- Rewrite the body of the count_built_in function to calculate and return the number of bilabials (b, m, p) in the parameter sentence using the built-in count method. For example, if the sentence is, “Boy, I thought I was the dummy!” the function should return 3. (We won’t worry about the fact the the ‘mm’ in ‘dummy’ is really only one troublesome phoneme.)
- Rewrite the body of the count_iterative function to count the number of bilabials in sentence using a loop. (Do not use the built-in count method.)
- Rewrite the body of the count_recursive function to count the number of bilabials in sentence using recursion. (Do not use the built-in count method.)
Grading – 10 points
- 3 points – The count_built_in function is implemented correctly.
- 3 points – The count_iterative function is implemented correctly.
- 4 points – The base case (2 points) and two general cases (1 point each) of the count_recursive function are implemented correctly.