+2 votes
in Programming Languages by (74.2k points)

Can I get a python code for the N-th number of the Fibonacci series?

1 Answer

+1 vote
by (349k points)
selected by
 
Best answer

Here is the python code for the N-th number of the Fibonacci series?

# n-th Fibonacci number
def fibonacciNumbersNth(n):
    a, b = 0, 1
    for i in range(n-1):
        a, b = b, a + b
    return a

if __name__ == "__main__":
    print(fibonacciNumbersNth(10))

 

The above code will output the following number:

34


...