Write a recursive function to return the nth Fibonacci number in Python

def fibonacci(n): if n <= 1: return n else: return fibonacci(n-1) + fibonacci(n-2)

FG

Related Python Mentoring answers

All answers ▸

What is the difference between a float and an integer variable type?


Write a simple number guessing game, give the user 3 tries to guess a number between 1 and 10


What can be used to iterate through a list in python?


Write a program that takes a value x and then outputs x Fibonnaci numbers. E.g. if x=6 output would be 1 1 2 3 5 8