I don’t understand how my code

could lead to a “IndexError: list index out of range” Python error

Consider whether every data set will have exactly 5,728 emails. Using fixed constants is rarely a good idea.

Thanks! What, in this case, is the best thing to say num_emails = ?

The emails are in the X variable.

So the number of emails comes from the length of the X variable.