Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1
A loop does not return a value, the function does. As soon as a function encounters a return statement, it terminates and returns the value to its caller (your program). So if you return a value from within your first for loop, the function jumps out of its execution right there and your second for loop is never executed.
20th Sep 2019, 8:25 AM
Shadow
Shadow - avatar