break, continue and loop else

break leaves the loop at once. continue skips the rest of this pass and moves on to the next item.

Loops can have an else block. It runs only if the loop finished without hitting break. Think of it as "no break". It fits search loops: break when you find the item, and handle "not found" in the else.

Many Python developers have never seen loop else, so it is a fair interview trivia question. In your own code, a function that returns from inside the loop is often clearer.

break only leaves the innermost loop. To get out of nested loops, put them in a function and return.

Run it, then change target to 4.