标签:app class range pre div 输入 end 练习 斐波那契数列
斐波那契数列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)
标签:app class range pre div 输入 end 练习 斐波那契数列
原文地址:https://www.cnblogs.com/howiehuang/p/11147446.html