Write the function search(word, substring) that takes in a word and a substring as arguments and returns the position (0 indexed) of the substring if it is found in the word. The function returns -1 if the substring is not found.
is there a method to do this? i tried;
def search(word, substring):
if substring in word:
return 1
else:
return -1
but on one of their tests it returned false, because i misunderstood the question i imagine. so how should i go about this problem?
thank you for any help~