Fibonacci sequence using list in PYTHON?

前端 未结 6 1447
清酒与你
清酒与你 2020-12-16 08:48

I have a problem about making a fibonacci sequence to a list, I\'m just new to python someone help me please.

This is my code. I know this is looking wrong or somet

6条回答
  •  孤街浪徒
    2020-12-16 09:26

    def fibonacci(n, results):
    if n == 0:   
        return 0  
    elif n == 1:  
        return 1  
    else :  
        f = fibonacci(n-1, results) + fibonacci(n-2, results)
        f1 = f[:]
        results.appned(f1)
    
    
        return results
    

提交回复
热议问题