For-Loop Help (15 Chars)

Hi I’ve learned the For Loop but I’m still confused what for loop does like the code below

for j in range(len(friends)):
        point = points[j]
        friend = friends[j]

Thanks

That code will make point the j element of the array points and friend the j element of the friends array. And this

Tells the program to increase j each time those commands are done

And it will stop increasing and repeating the loop when j will become len(friends). Do you understand?

Andrei

1 Like

I still don’t understand (len(friends)) part. Whats the point of adding it?

1 Like

It tells the program to stop executing the loop once j == len(friends).

Andrei

1 Like

Thanks for the help!

1 Like