# 斐波那契迭代def fab(n): n1=1 n2=1 n3=1 while(n-2)>0: n3 = n2+n1 n1 = n2 n2 = n3 n-=1 return n3print(fab(20))# 斐波那契递归 很慢很慢def F(n): if n==1 or n==2: return 1 else: return F(n-1)+F(n-2)print(F(30))