Posted in Python onFebruary 14, 2014
def getFibonacci(num): res=[0,1] a=0 b=1 for x in range(0,num): if x==a+b: res.append(x) a,b=b,a+b return res res=getFibonacci(1000) print(res) #递归 a=[0,1] qian=0 def fibna(num,qian): print(num) he=num+qian if he<1000: a.append(he) qian=num fibna(he,qian) fibna(1,0) print(a)
python求斐波那契数列示例分享
声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@