Goal: Read the first and last values.
Open a box by its number
An array keeps values in a row of numbered boxes. The number of a box is its index, and it starts at 0. To read a
box, write the array's name with the index in square brackets: nums[0] is the first value.
That's why reading any box is instant, however long the array is. The computer doesn't search: it goes straight to box 3, the way you'd walk straight to locker 3.
Box 0 holds 6, the first value. In code that's nums[0].
The last box is one less than the length
The length is how many boxes there are. With 5 boxes numbered from 0, the numbers are 0, 1, 2, 3 and 4. So the last box is always the length minus one.
Asking for box 5 in a row of 5 is asking for a locker that isn't there. Depending on the language you'll get an error or a strange value, so it's worth getting this right early.
marks = [72, 85, 64, 90, 58] # the first box top = marks[0] # the last box: length minus one bottom = marks[len(marks) - 1]