Question: Write a recursive function(function needs to be called within the function) called occurrences with two parameters: a string astr and another (nonempty) string substr. The
Write a recursive function(function needs to be called within the function) called occurrences with two parameters: a string astr and another (nonempty) string substr. The function returns the number of times the substring substr appears in the string astr. For example, occurrences("how now brown cow", "ow") should return 4 and occurrences("house mouse louse", "ow") should return 0. As above, all usual restrictions apply for the recursive implementation.
Please use correct indentation and this is to be written in Python 3.5
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
