利用函数编写如下数列:

斐波那契数列指的是这样一个数列 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233,377,610,987,1597,2584,4181,6765,10946,17711,28657,46368

#!/usr/bin/env python
#_*_ coding:utf-8 _*_
__author__ = 'yiyezi'



def func(arg1,arg2):
    if arg1 == 0:     
        print(arg1,arg2)

    arg3 = arg1 + arg2
    print(arg3)

    func(arg2,arg3)

func(0,1)


#返回值
def func(arg1,arg2):
    if arg1 == 0:
        pass

    arg3 = arg1 + arg2
    if arg3 > 1000:
        return arg3

    ret = func(arg2,arg3)
    return ret

result = func(0,1)
print(result)


与其相关的是武Sir写的计算器相关的博客

http://www.cnblogs.com/wupeiqi/articles/4949995.html