I don’t understand this Python question and need help to study.

Assignment

  • 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.

“Looking for a Similar Assignment? Order now and Get a Discount!