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 ▸

How do I check if a number is prime using a python program?


How would you get a piece of code to print the numbers 1 to 10


Write a function s(n) that will return a list of the first n squares.


Use recursion to print all the sublists of a given list