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

博文

Python-Note-4-Continue-statements

已有 2081 次阅读 2017-4-11 01:59 |个人分类:Python 笔记|系统分类:科研笔记

Continue statements

If the continue function is executed, go back to the start of the clause of the while loop.


Example:

while True:

   print('please type your name')

   name=input()

   if name!='Jack':

       continue

   print('type your password')

   password=input()

   if password=='password':

       break

print('Welcome to Python'+name)


Nb: if the username is Jack, type and match the password. Otherwise, go back to the beginning of the while loop.



https://wap.sciencenet.cn/blog-850613-1048044.html

上一篇:Python-Note-3-break-while-loop
下一篇:Python -Note-5-for-statements
收藏 IP: 80.101.95.*| 热度|

0

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

数据加载中...

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

GMT+8, 2024-4-16 16:35

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部