Last answered:

06 Jan 2023

Posted on:

26 Dec 2022

0

i find some parts in the lectures difficult to understand

image.png

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

06 Jan 2023

1

Hi Andrew!
Thanks for reaching out.

The first for loop itterates through every element from the array using the name of the array.
The second for loop uses the range() method with an argument len(x). This means we use range(3) in this loop. In the print statement we use x[item]. The item variable is initially 0, then 1 and then 2. So, using x[item] means x[0], x[1] and x[2]. To sum up, the first loop iterates through the elements of the array and the second one does the same but with the help of indexing.

Hope this helps.
Best,
Tsvetelin

Submit an answer