nth Term of Fibonacci Series in Python: Write a Python function which gives nth term of Fibonacci series. Fibonacci series is a sequence of numbers in which each number is the sum of the two preceding numbers. For example: 0, 1, 1, 2, 3, 5, 8, 13, 21....
nth Term of Fibonacci Series in Python
An interesting feature of Fibonacci numbers is that ratio of consecutive Fibonacci numbers is equal to 1.618, also known as the Golden Ratio.
def elementInFibonacciSeriesAtPosition(enteredPosition): a, b = 0, 1 fibonacciNumbers =  while True: fibonacciNumbers.append(a) a, b = b, a+b if len(fibonacciNumbers) == enteredPosition: print(fibonacciNumbers.pop()) break elementInFibonacciSeriesAtPosition(11) # 55