2021-09-12、while循环
程序员文章站
2022-07-14 23:35:40
...
1、无限循环形式:
APPLE = True
while APPLE:
print('1')
2、设置限制循环的条件:
APPLE = 3
while APPLE <= 11:
APPLE += 2
print(APPLE)
3、while与else的结合使用:
APPLE = 3
while APPLE <= 11:
APPLE += 2
print(APPLE)
else:#当APPLE不满足APPLE <= 11时,会运行
print('over')