Dãy số Fibonanci được định nghĩa như sau:
F0=0; F1=1; Fn=Fn-1 + Fn-2 (n>=2)
Code minh họa
n=int(input("n= ")) A=[0,1] for i in range(2,n): Fi=A[i-1]+A[i-2] A.append(Fi) print(A)
https://tritue.edu.vn/tuecode/tracnghiem30/index.php/baiviet/post/view/id/213?id=213