美文网首页
while循环

while循环

作者: huojusan | 来源:发表于2018-05-21 13:22 被阅读5次
    # -*- coding: utf-8 -*-
    # @Author: yt
    # @Date:   2018-05-21 09:10:23
    # @Last Modified by:   yt
    # @Last Modified time: 2018-05-21 09:14:11
    
    i = 0
    numbers = []
    
    while i<6:
        print "At the top i is %d" % i
        numbers.append(i)
        i=i+1
        print "numbers now:",numbers
        print "At the bottom i is %d" % i
    
    print "The numbers:"
    
    for num in numbers:
        print num
        
    
    运行结果如下: 图1

    相关文章

      网友评论

          本文标题:while循环

          本文链接:https://www.haomeiwen.com/subject/qhzxjftx.html