a = 0
b = 10
while a!=b:
print("a!=b")
a += 1
else:
print("a==b")
In python, else may be attached to the while statement. The contents of the else block are executed when the condition judgment becomes false (when exiting the loop). However, when the break statement is exited, the condition judgment is not false, so the else block is not executed.