Python利用生成器函数或递归生成斐波那契数列 1,1,2,3,5,8,13...

  生成器生成数列:函数     def  create_fbnq(n):递归         a,b=0,1         i=0         while i<n:             yield b              a,b=b,a+b             i+=1     for x in  create_fbnq(20):         print(x)yield
相关文章
相关标签/搜索