How to look up if a string in one list is a part of another list:
b_names = ['robert', 'jon', 'arya']
a_names = ['rya', 'fish']
def filterA(name):
for string in b_names:
if name in string:
return True
else :
return False
final_list = filter(filterA,a_names)
The final_list is empty and should have contained the string rya since rya is present as a substring in the arya from the first list.
What is the error here ?