Coding basics · 16 of 20
First n Fibonacci numbers
Return the first n Fibonacci numbers: 0, 1, then each number is the sum of the two before it.
Jump to the editor ↓Examples
Input n = 7
Output [0, 1, 1, 2, 3, 5, 8]
Input n = 0
Output []
Coding basics · 16 of 20
Return the first n Fibonacci numbers: 0, 1, then each number is the sum of the two before it.
Jump to the editor ↓Input n = 7
Output [0, 1, 1, 2, 3, 5, 8]
Input n = 0
Output []
Tab indents · ⌘/Ctrl+Enter runs · Esc leaves the editor