《Python 第六章》抽象

--------67.py-----------
#!/usr/bin/python
# filename : interval

def interval(start, stop = None, step = 1) :
    if stop is None : 
        stop = 10
    result = []
    i = start
    while i < stop :
        result.append(i)
        i += step
    print result
    return result

interval(1)
interval(1, 5)
interval(2, 20, 3)
慎重使用全局变量

posted @ 2013-03-04 20:21  小尼人00  阅读(101)  评论(0编辑  收藏  举报