write an algorithm to find the fibonacci series till term≤1000
Answers
Answered by
1
Answer:
mark me as the brainliest
Explanation:
mark me down as the brainliest
Answered by
0
Answer:
a = 1
b = 1
n = 1000 # Set this to however many terms you want to generate
series = [1, 1]
for x in range(2, n):
next = series[x - 1] + series[x - 2]
series.append(next)
print(series)
Explanation:
What I have done here is set up a for loop in range(2, n) . Since n is equal to 20 in this example, the for loop loops for each x in the interval [2, n]. Indented inside the loop is our definition of the Fibonacci sequence: that each term is the sum of the 2 terms preceding it. Finally, the loop appends that term to the list series .
Similar questions