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
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
I still don’t understand (len(friends))
part. Whats the point of adding it?
It tells the program to stop executing the loop once j == len(friends).
Andrei
Thanks for the help!