For-else in PythonΒΆ

for i in range(5):
    if i == 5:
        break
else:
        print('No break encountered')
print('Out of loop!')
No break encountered
Out of loop!
for i in range(10):
    if i == 5:
        break
else:
        print('No break encountered')
print('Out of loop!')
Out of loop!