斐波那契数列
2019-12-18 本文已影响0人
而立之年的技术控
![](https://img.haomeiwen.com/i13792534/0c13e6241cbb6ef5.jpg)
class Solution:
def Fibonacci(self, n):
# write code here
if n == 0:
return 0
if n == 1:
return 1
if n > 1:
a = 0
b = 1
for i in range(n): ## 这个地方是n此循环
a, b = b, a + b
return a