Question: def recursiveSubstring(s, sub): ''' The parameters sub and s are strings. This function computes if the string sub exists in s. - Your solution must

def recursiveSubstring(s, sub): ''' The parameters sub and s are strings. This function computes if the string sub exists in s. - Your solution must use recursion in order to receive credit. ''' if len(s) < len(sub): return False elif s[:len(sub)] == sub: return True recursiveSubstring(s[1:],sub)

This python function must determine if the subString is in s, recursively. This is my solution, which only works if the substring is in the first characters of s. What is a recursive solution to the function recursiveSubstring?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!