Python 斐波那契數列

 Python 斐波那契數列python def fib(n): a=[0,1] while len(a)<n: a.append(a[-1] + a[-2]) return a[:n] print(fib(13)) 結果爲: app [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144]
相關文章
相關標籤/搜索