Hi all

Two questions regarding :

RECURSION VS. ITERATION - CODING THROWDOWN

# When Fibs Are Good

One , in calculations for fibonacci when we ask for a 3rd number in sequence we actually return the 4th one in the set. Why is that i think i don’t understand something.

for fibonacci(3) the list is [0, 1, 1, 2] and we return [2] but it’s the fourth element .

Secondly I only started learning but I have read in multiple places how important code readability is and I think the recommended way of solving this exercise is unnecessarily complicated especially for beginners.

Is there any advantage to that way over my way ?

Code :

```
#readable
def xfibonacci(n):
result = 0
first = 0
second = 1
for i in range(n-1):
result = first + second
first = second
second = result
print(result)
return result
#codecademy suggested
def fibonacci(n):
fibs = [0, 1]
if n <= len(fibs) - 1:
return fibs[n]
else:
idx = 2
while n > len(fibs) - 1 :
nx = fibs[idx - 1] + fibs [idx - 2]
fibs.append(nx)
idx += 1
print (fibs)
print(fibs[n])
return fibs[n]
# test cases
print(fibonacci(3) == 2)
print(fibonacci(7) == 13)
print(fibonacci(0) == 0)
```