You can download this code by clicking the button below.
This code is now available for download.
Compute and return a list containing the first n Fibonacci numbers.
Technology Stack : math, random
Code Type : Function
Code Difficulty : Intermediate
import math
import random
def fibonacci(n):
a, b = 0, 1
result = []
for i in range(n):
result.append(a)
a, b = b, a + b
return result