zoukankan      html  css  js  c++  java
  • 多测师讲解python_斐波那契数列:_高级讲师肖sir





    def f(n):
    a,b=1,1
    if n==1 or n ==2:
    return 1
    else:
    i=3
    while i<=n:
    a,b=b,a+b
    i+=1
    return b

    print(f(int(input(" 斐波那契数列:"))))

    hu= int(input("斐波那契数列:"))
    new = []
    def a(n):
    if n>=3:
    v=a(n-1)+a(n-2)
    else:
    v=1
    return v

    print("开始")

    for i in range(0,shu):
    new.append(new(i+1))
    print(new)
  • 相关阅读:
    LeetCode
    LeetCode
    LeetCode
    LeetCode
    LeetCode
    LeetCode
    LeetCode
    LeetCode
    LeetCode
    LeetCode
  • 原文地址:https://www.cnblogs.com/xiaolehua/p/13703930.html
Copyright © 2011-2022 走看看