I only answer this again because I notice that your subject is already reporting a problem and no one has given a theoretical explanation here. The theoretical word is too big in this case, but anything.
, return for. For-loop . , , . , , :
def get_index(needle, haystack):
for x in range(len(haystack)):
if haystack[x] == needle:
return x
, , , ( , ). , , , return AFTER for-loop, , ,
def add(numbers):
ret = 0
for x in numbers:
ret = ret + x
return ret
( , )