Respuesta :

Your loop is iterating too many times.
You're creating a list that can hold 5 objects,
and then you're going through your loop 6 times.
for loop in range(5):

The word that you used, "loop" is the index value that counts from 0 to 5 (iterates over the first 6 values starting from 0).

loop = 0 the first time through, then
loop = 1 the next time,
... up to
loop = 5.

So one option is to use this word loop to find each location in your list,
people[loop] = name
(for the fourth line)

Also, I don't think this sorted will sort the list "in place".
I think you need to save it.
people = sorted(people)

I could be wrong though, I'm still a little new to Python :D