continue与break 布尔值 整体注释:ctrl+?

continue与break:

continue:终止本次循环,开始下次循环 。

break:终止所有循环。

用户登录(三次机会重试)

count=0

while count<3:

  user=input('>>>')

  pwd=input('>>>')

  if user=='root' and pwd=='123456':

    print('欢迎登录')

    print('.................')

    break

  else:

    print('用户名或密码输入错误')

  count=count+1

整体注释:ctrl+?

布尔值:

真 True          if True:   永远是真                   while True:   死循环

假 False         if False:  永远不成立

猜你喜欢

转载自www.cnblogs.com/jiaqing767418611/p/9113972.html
今日推荐