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 ▸

Create a python code to sum the number from 1 to 10.


What are recursive functions and when should they be used?


Given a list of N numbers, use a single list comprehension to produce a new list that only contains those values that are: (a) even numbers, and (b) from elements in the original list that had even indices .


Define a function that takes in the age of the user and adds it to an output sentence such as "You are ..... old".