## -Treysure- 的CSDN博客

github：https://github.com/Treysure

# 【Python】Python_learning7：Python中斐波那契数列三种写法

-----------------------------------------------------------------------------

"""

#!/usr/bin/python
# -*- coding: UTF-8 -*-
l = []
def fib(n):
a = 1
b = 1
for i in range(n-1):
a, b = b, a + b
l.extend([a,b])

return (a)
print("The 2result1 is:",fib(10))
print('The 2result2 is:',l)
'''
l = []
for i in range(7):
x = input('integer:\n')
l.append(x)
l.sort()
print('The result is:',l)
print(l)
'''


-----------------------------------------------------------------------------

"""

#!/usr/bin/python
# -*- coding: UTF-8 -*-
def fib(n):
if n == 1:
return [1]
if n == 2:
return [1,1]
fibs = [1,1]
for i in range(2 , n):
fibs.append(fibs[-1] + fibs[-2])
return (fibs)
print("The right result is:",fib(50))


#### 斐波那契数列的算法实现 —— python

2015-10-26 19:05:02

#### Python中斐波那契数列实现

2017-04-25 16:35:47

#### 用Python简单实现斐波那契数列

2016-07-31 12:47:28

#### 斐波那契数列 python实现

2017-11-19 12:03:47

#### python学习系列---斐波那契数列的多种实现

2017-10-17 20:29:51

#### Python实现一个简易的斐波那契数列

2016-11-01 21:18:13

#### Python计算斐波那契数列

2015-05-22 20:29:54

#### Python中斐波那契数列的四种写法

2017-11-02 21:47:22

#### 斐波拉契数列的python多种完美实现

2014-05-26 17:39:16

#### python实现最简单斐波那契数列

2017-09-13 10:37:45