Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Fibonnacci

DZone's Guide to

Fibonnacci

·
Free Resource
// 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:

Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}