Last answered:

06 Jan 2023

Posted on:

26 Dec 2022


i find some parts in the lectures difficult to understand


1 answers ( 0 marked as helpful)
Posted on:

06 Jan 2023


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.

Submit an answer