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 ▸

Give a segment of python code that will print the numbers 1 to 7, each one on a new line


What is the difference between a for loop and a while loop?


How would you loop over every key and value in a python dictionary?


Which function is ran when an object is instantiated?