Question #349

for loops can have an else clause.

for loops can have an else clause. The else clause executes after the loop completes normally.


for item in container: if search_something(item): # Found it! process(item) break else: # Didn't find anything.. not_found_in_container()
(book.pythontips.com/en/latest/for_-_else.html)


Comment on Disqus:

Question difficulty: 🔵🔵🔵🔵🔵