退出循环语句
# 案例1
while 1:
name = input("用户名:")
pwd = input("密码:")
if name = "rain" and pwd == "123"
print("登录成功!")
break
else:
print("登录失败")
print("程序继续!")
# 计算1+2+3+4+5+65+67+...100的结果
count = 0
num = 0
while count < 100: # 循环语句
count += 1 # 步进语句: count = count +1
if count == 66:
# break # 退出整个循环
continue # 退出当次循环
num = num + count
print(num)
标签:语句,count,num,print,循环,退出 From: https://www.cnblogs.com/kaxiu/p/17387606.html