Last answered:

25 Jan 2023

Posted on:

25 Jan 2023

0

Resolved: Question 7: Where is the i?

Hello,

I am a little confused about this lines

for i in range (n)
    fib_numb.append (a)
    a,b = b, a+a

Where is the 2. i in this? I thought i has to be in the next line used in a for loop to work. Why does it work now without a second line with i?
Because of my understanding, I had quite a struggle to solve the question quickly.

Thanks for the help in advance!

1 answers ( 1 marked as helpful)
Instructor
Posted on:

25 Jan 2023

1

Hey Daria,

Thank you for reaching out!

In this case, i serves as a counter which counts the number of iterations we have to perform. Examine the following code:
image.png
Here, I've added a print-function including the iterator i to illustrate how its value changes.

Hope this helps!

Kind regards,
365 Hristina

Submit an answer