📜  我们可以在 python 代码示例中使用 else 而不使用 if

📅  最后修改于: 2022-03-11 14:45:58.787000             🧑  作者: Mango

代码示例1
In most of the programming languages (C/C++, Java, etc), the use of else statement has been restricted with the if conditional statements. But Python also allows us to use the else condition with for loops. The else block just after for/while is executed only when the loop is NOT terminated by a break statement