Over a million developers have joined DZone.

Fibonnacci

·
// calculates the nth fibonacci number


def fibonacci(number):
	if number == 0 or number == 1:
		return number;
  	else:
		result = fibonacci(number-1) + fibonacci(number-2)
		return result
Topics:

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}