python3.x 简单的for语句循环案例
2017-11-07 11:20
309 查看
python简单完成一个for循环并且使用break及continue并查看其效果
#!/usr/bin/env python # Auther by wq for i in range(0,10): if i <5: print("loop",i) else: continue #跳出本次循环进入下一个循环 print("hehe...") print("jump out this recycle") for i in range(10): print('--------------',i) for j in range(10): print(j) if j >5: break #跳出本小循环
输出结果:
loop 0 hehe... loop 1 hehe... loop 2 hehe... loop 3 hehe... loop 4 hehe... jump out this cycle -------------- 0 0 1 2 3 4 5 6 -------------- 1 0 1 2 3 4 5 6 -------------- 2 0 1 2 3 4 5 6 -------------- 3 0 1 2 3 4 5 6 -------------- 4 0 1 2 3 4 5 6 -------------- 5 0 1 2 3 4 5 6 -------------- 6 0 1 2 3 4 5 6 -------------- 7 0 1 2 3 4 5 6 -------------- 8 0 1 2 3 4 5 6 -------------- 9 0 1 2 3 4 5 6 Process finished with exit code 0
相关文章推荐
- for循环语句的简单列子
- 简单使用序列for循环语句
- 简单学习JavaScript中的for语句循环结构
- 简单学习JavaScript中的for语句循环结构
- 简单编程(六)使用for循环语句 编写程序1+2+3+...........+100
- for循环的执行顺序(案例+详解)
- AS 入门-“for”循环语句
- PHP循环语句详解 while, for, foreach, do while
- go语言循环语句 for
- PHP循环语句深度理解分析——while, for, foreach, do while
- 2.4.4认识循环结构-for语句
- 循环与递归--不使用if,while,for,do—while语句来输出所有比已知数N小的自然数
- 循环语句 for
- JavaScritp( for 循环语句的理解 )
- For循环语句的使用和函数的调用
- while,do while和for循环语句的用法
- python中for语句简单遍历数据的方法
- JavaSE教程-04Java中循环语句for,while,do···while-练习2
- JAVA输出九九乘法表,用for,dowhile,while循环语句输出
- C# 3循环 for语句应用