python求斐波那契数列示例分享
时间:2022-07-20 19:32:10
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,斐波那契数列
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
ASP基础教程:常用的 ASP ActiveX 组件
2008-10-14 15:15:00
![](https://img.aspxhome.com/file/UploadPic/200812/20081213132956582.gif)
写给应聘页面重构的同学
2009-03-18 11:01:00
是时候不用考虑基于字体大小(em)的设计了
2009-10-24 13:25:00
Div的浮动+循环(描述的不清楚,请看图)
2008-09-22 20:21:00
![](https://img.aspxhome.com/file/UploadPic/20089/22/banner_85s.jpg)
python使用nibabel和sitk读取保存nii.gz文件实例
2021-03-11 16:12:53
![](https://img.aspxhome.com/file/2023/8/64708_0s.jpg)
jQuery 选择器的使用
2008-01-21 13:07:00
详解php实现页面静态化原理
2023-10-25 10:58:10
php中用socket模拟http中post或者get提交数据的示例代码
2023-11-19 00:45:21
利用Python实现最小二乘法与梯度下降算法
2021-07-19 03:59:49
![](https://img.aspxhome.com/file/2023/9/82599_0s.png)
Python多进程分块读取超大文件的方法
2023-12-07 02:19:28
菜鸟课堂:MSSQL的安全设置问题解答
2009-10-29 13:22:00
python中startswith()和endswith()的用法详解
2023-11-02 12:41:09
十几行的超简日历组件(兼容FF)js源码
2010-08-08 08:49:00
HTML在线编辑器的实现难点
2010-06-26 12:58:00
pandas分组聚合详解
2023-06-28 15:50:25
python设置中文界面实例方法
2023-08-30 18:56:30
![](https://img.aspxhome.com/file/2023/8/62278_0s.png)
Python3实现飞机大战游戏
2022-08-25 05:29:03
![](https://img.aspxhome.com/file/2023/6/81826_0s.jpg)
Php获取金书网的书名的实现代码
2023-07-14 02:31:21
Python 内置高阶函数详细
2022-07-26 11:02:07
Python函数式编程之返回函数实例详解
2021-10-31 03:46:26
![](https://img.aspxhome.com/file/2023/2/80402_0s.png)