Memra

The nth Fibonacci number

◈ 1 cards

Loops that build on themselves.

Loops that build on themselves

The Fibonacci sequence starts 0, 1, and each number after is the sum of the two before it. A loop can carry the last two values forward and add them, step by step.

Type the function below, then run it — it should print the 10th Fibonacci number.

NORMAL ~/memra/learn/python-from-zero/nth-fibonacci utf-8 LF