好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

python中while循环的使用方法

这篇文章主要介绍了python中循环语句while用法,实例分析了while语句的使用方法,需要的朋友可以参考下

#!/usr/bin/python
# Simple while loop
a = 0
while a < 15:
  print a, # 在print a后面加,不换行
  if a == 10:
    print "made it to ten!!"
  a = a + 1 

运行结果如下:

0 1 2 3 4 5 6 7 8 9 10 made it to ten!!
11 12 13 14

以上就是python中while循环的使用方法的详细内容,更多请关注Gxl网其它相关文章!

查看更多关于python中while循环的使用方法的详细内容...

  阅读:39次