Why does my middle_third return the wrong range of numbers?


#1

Question

Why does my middle_third return the wrong range of numbers?

Answer

The instructions ask us to “create a third list, middle_third, that’s equal to the middle third of to_21, from 8 to 14, inclusive.”
8 and 14 are not indexes, they mean the 8th and 14th number, since that would be the middle third of the to_21 list.
Accessing the 8th number would mean accessing the 7th index, and the 13th index with 14, since the last number is not included and counting starts at 0.


FAQ: Learn Python - Advanced Topics in Python - Practice Makes Perfect