日期0705Python练习006
斐波那契数列Fn = F[n-1] + F[n-2]
n = input("请输入数字") n = int(n) a = [] if n == 1: a = [0] elif n == 2: a = [0,1] else: a = [0,1] for i in range(2,n): a.append(a[i-1] + a[i-2]) print(a)
斐波那契数列Fn = F[n-1] + F[n-2]
n = input("请输入数字") n = int(n) a = [] if n == 1: a = [0] elif n == 2: a = [0,1] else: a = [0,1] for i in range(2,n): a.append(a[i-1] + a[i-2]) print(a)