I am trying to implement a function that find a text in a string recursively.
I tried this, but I don't know why it's not working. Please note that I am new to coding.
def find(text, substring):
if len(text) == 0:
return 0
while substring[0] in text:
return find(text, substring[1:])
Thanks! :)
Example:
find("mississippi", "sip")
True
find("to be or not to be", "be")
True
find("mississippi", "sup")
False