def func(l1, l2):
result = False
for x in l1:
for y in l2:
if x == y:
result = True
return result
print(func([1,2,3,4,5], [5,6,7,8,9])) >> True
print(func([1,2,3,4,5], [6,7,8,9])) >> None
Why does the function return None in the second case? It should return 'result' which is True or False.
resultafter your loop.