Hey (bad english) so i am working on a function that is going to check if a string1 is inside another string2. i do belive i have accomplished this, but after that, i am trying to find the index of where the string2 was found in the string1. if the string is not in the string at all it will return (-1). i have tried googling around and looking for asnwers i have seen someone use s.find(), but for somehow can't use it. Therefor i am asking here for some help this is how i have come:
def contains_string(str1, str2):
if str1 in str2:
print(str1.find(str2))
else:
print("-1")
return
str1 = Ronaldo
str2 = Ron
str3 = Messi
print(contains_string(str1, str2))
print(contains_string(str1, str3))
#outcome should be:
#3 <- because Ron goes to index 3 in str1
#-1
i think i am really close, but i am not sure what i am missing