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 are recursive functions and when should they be used?


What are docstrings and how do I use them to improve my code readability?


How could I write a program to convert Km/h to m/s in python


How do I define a function in Python?