krishshharma/Code-Explainer
0
1# Fibonacci function2def fib(n):3 """4 Computes Fibonacci sequence up to n terms5 Example: fib(5) → [0, 1, 1, 2, 3]6 """7 a, b = 0, 18 result = []9 for _ in range(n):10 result.append(a)11 a, b = b, a + b12 return result13 