Fibonacci Sequence Calculator

  • Share this:

Code introduction


This function calculates the nth term of the Fibonacci sequence


Technology Stack : None

Code Type : Function

Code Difficulty : Intermediate


                
                    
def fibonacci(n):
    a, b = 0, 1
    for _ in range(n):
        a, b = b, a + b
    return a

# JSON Explanation                
              
Tags: