Py学习  »  Python

在python中返回最多n项的斐波那契数列[重复]

Sumit Dwivedi • 3 年前 • 1679 次点击  

我很难理解其中的逻辑,比如如何创建一个python函数,该函数以n为参数,n是从0开始的斐波那契数列中获取的元素总数,然后返回一个斐波那契数列列表,直到这些元素数为止。

E.g. Input = 3 then Output = [0,1,2]
Input=6 then Output = [0,1,1,2,3,5]
Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/133114
 
1679 次点击  
文章 [ 3 ]  |  最新文章 3 年前