Write a function to get nth element of the fibonacci series
Topic: Write a function to get nth element of the fibonacci series
Solution
def fibonacci_nth(n): a = 0 b = 1 if n <= 0: print("Incorrect input") elif n==1: return a elif n==1: return 1 else: for i in range(2, n): c = a + b a, b = b, c return b
List all Python Programs