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

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

1 Answer

0 votes
by (20k points)

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

...