jack0he的个人博客分享 http://blog.sciencenet.cn/u/jack0he

博文

Python-Note-3-break-while-loop

已有 2156 次阅读 2017-4-10 23:00 |个人分类:Python 笔记|系统分类:科研笔记

break statements

Function: break while loop. If the break statement is executed, the while loop is terminated.


Example

Code in Pytho-Note-2-while loop

name=''

while name!='your name':

   print('please type your name')

   name=input()

print('thank you')


name=''

while True:

   print('please type your name')

   name=input()

   if name=='your name':

       break

print('thank you')







https://blog.sciencenet.cn/blog-850613-1048034.html

上一篇:Python-Note-2-While-loop-statements
下一篇:Python-Note-4-Continue-statements
收藏 IP: 80.101.95.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-4-25 03:16

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部