码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2018-05-31 00:29:18      阅读:136      评论:0      收藏:0      [点我收藏+]

标签:tin   and   用户名   pwd   ctrl   ==   style   roo   count   

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:  永远不成立

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

标签:tin   and   用户名   pwd   ctrl   ==   style   roo   count   

原文地址:https://www.cnblogs.com/jiaqing767418611/p/9113972.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!