by default, a function returns at the end, which we can prove:
print "function needs to do something"
i put a print statement in front of the function call, this is to print the returned result. As you can see when running this code, it should say
we didn’t specify this, but it seems one of python features is to return
None at the end of the function.
If we want to return something else at end of the function we can use the return keyword:
print "i get executed"
print "i won't get executed, given return ends the function"
however, as you can see, the return keyword ended the function, the second print statement is never reached.
So, in your function,
return will break the loops, so the function can end. Given that
return is the last action a function takes