Dinosaur Island Exercise 4 model

Dear Mentor,

Below statement not understandable. can you please elaborate what does it mean ?

Set the index idx into the list of examples
  • Using the for-loop, walk through the shuffled list of dinosaur names in the list “examples.”
  • For example, if there are n_e examples, and the for-loop increments the index to n_e onwards, think of how you would make the index cycle back to 0, so that you can continue feeding the examples into the model when j is n_e, n_e + 1, etc.
  • Hint: (n_e + 1) % n_e equals 1, which is otherwise the ‘remainder’ you get when you divide (n_e + 1) by n_e.
  • % is the [modulo operator in python]

We have a list of names with a certain number of elements, right? Call that number n_e. Now we are running a loop for a particular number of iterations, which may end up being greater than n_e. On each iteration of the loop, the input needs to be one of the names from the list. So how do we handle it if the iteration number goes beyond the length of the list? They are telling us how to do that: use the “modulo” operator in python. If you aren’t familiar with that, here is a docpage. It’s equivalent to “mod” in math.