Fibonacci numbers | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Fibonacci numbers

This Python code defines a function called `fibonacci(n)` that generates a list containing the first `n` terms of the Fibonacci sequence. It handles special cases when `n` is less than or equal to 0, 1, or 2. For values of `n` greater than 2, it iteratively calculates the next Fibonacci numbers using a while loop and appends them to the list. The final result is a list of Fibonacci numbers up to the specified `n`.

15th Sep 2023, 6:12 AM
Ibrahim
Ibrahim - avatar
1 Answer
+ 4
It's a cool task. Do you need help? Maybe reading these might help, or if you update your post, then it should help us to help you: https://code.sololearn.com/Wek0V1MyIR2r/?ref=app https://code.sololearn.com/WZ8lkR6gTex6/?ref=app https://code.sololearn.com/W3uiji9X28C1/?ref=app https://code.sololearn.com/W0uW3Wks8UBk/?ref=app
15th Sep 2023, 8:45 AM
Ausgrindtube
Ausgrindtube - avatar