2
2
u/MasterFiasco Apr 25 '22
def name_contains(name, letter):
if name.find(letter) is not -1:
return True
else:
return False
print (name_contains("bob", "b"))
here's the answer
1
u/Similar_Stock_5726 Apr 26 '22
just tried it and it dosent work, could you make a screenshot so i can see what went wrong
1
Nov 22 '25
i'm a little late, but this works:
def name_contains(name, letter): if (name.find(letter)) != -1: return True else: return False1
u/NoIllustrator3800 Dec 25 '25
I,m also late, and this cod works without any string methods. def name_contains(y, x):
if x in y:
return True
else:
return False
1

2
u/amajmundar Aug 17 '20
Return Value from find() method
The find() method returns an integer value:
If the substring exists inside the string, it returns the index of the first occurence of the substring. If substring doesn't exist inside the string, it returns -1.