I am new to Python and I am trying to understand the FOR loop.
I am have created a function that searches whether a particular name is in a list. If it is, it should return true.
I understand that break exits the loop .. but why does it not in my case?
def nameSearch(names, target): for x in names: if x == target: return True break else: return False