Totally Lost in Zoo Keeper


#1

I just started this level and have no idea what some of these things mean. For instance:

What is “i”? How is it derived? What does it mean?

Also:

What is “j”? How is it defined? What are “points[j]” and “friends[j]”?

And lastly, what is “range(len(friends))”? I can read that this is the range of the length of the friends array, but what does that mean?

I’m pretty much stuck here at this level and can’t proceed until I get some answers and explanations. Even after watching the video tutorial I’m really lost and confused here.

Thank you.


#2

Hey, sorry to see you’re having trouble with these levels.

for variable_name in array:

is a Python loop, similar to:

index_name = 0
while index_name < len(array):
    variable_name = array[index_name]

The range(n) function creates an array of numbers between [0, ..., n]

So in this case for Zoo Keeper, it is iterating over each element in an array of numbers to use as an index for 2 different arrays.