def fibonacci(n):
# return a list of fibonacci numbers
numbers = [0, 1]
for i in range(2,n):
numbers.append(numbers[i-1] + numbers[i-2])
return numbers[0:n]
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter