An iterative algorithm for Fibonacci numbers

后端 未结 13 1135
野性不改
野性不改 2020-11-28 10:37

I am interested in an iterative algorithm for Fibonacci numbers, so I found the formula on wiki...it looks straight forward so I tried it in Python...it doesn\'t have a prob

13条回答
  •  一向
    一向 (楼主)
    2020-11-28 11:30

    Another possible approach:

    a=0
    b=1
    d=[a,b]
    n=int(input("Enter a number"))
    i=2
    while i

提交回复
热议问题