Hey everyone, I tried to write my own code for the fibonacci exercise. Comparing it to the solution, it looks pretty similar, but mine doesn’t work. Can someone please have a look and see what mistakes I have made in my code? Thanks!
Edit: The indents aren’t showing up, but they are the same as in the solution.
def fib(n):
if n<=0:
return -1
fib1==0
fib2==1
fibn==0
count==3
if n==1:
return fib1
if n==2:
return fib2
while count<=n:
fibn==fib1+fib2
fib1==fib2
fib2==fibn
count+=1
return fibn