As per this lesson Python Loops Challenge: Divisible by ten. What indentation should
return be at?
return to leave a function, it is important to have it at the correct level of indentation. When a line with
return is run, the entire function will cease running and will output what followed the return. Normally, this isn’t too tricky, just put it at the end of your function right?
Def my_function(): do stuff return thing
But what if you have a loop like
while in your function? What level does the return need to be at? The below quote from mtf details an explanation of this.
When he refers to above, think of a function that you want to iterate through every item in a list (like in the original lesson).
I hope this helps everyone with this concept, if you are still having challenges please discuss below.