循环

循环

if 语句

if condition_1:
statement_block_1
elif condition_2:
statement_block_2
else:
statement_block_3

while 循环

while 判断条件(condition):
执行语句(statements)……
你可以使用 CTRL+C 来退出当前的无限循环。
while 循环使用 else 语句
while :
<statement(s)>
else:
<additional_statement(s)>

for 语句

for in :

else:

for 实例中使用了 break 语句,break 语句用于跳出当前循环体:

posted @ 2022-03-02 15:48  辛宣  阅读(31)  评论(0)    收藏  举报