Here is my current code:
It uses an equation to figure out the Fibonacci Sequence. However, I need to use an accumulator instead of the exponential ( ** i) to get the same results. Can someone help me?
Code:
def fibClosed():
n=input("Enter a maximum value of n you'd like to compute")
for i in range (n+1):
x= round((1 / math.sqrt(5)) * ((1+math.sqrt(5))/2) ** i)
print i, int(x) , type(i)
Comment