Python Python Sequences Sequence Operations Creating Slices

2,002 Points

Help! I can't seem to understand this

I need help with this question. can someone explain the answer to me?
student_gpas = [4.0, 2.3, 3.5, 3.7, 3.9, 2.8, 1.5, 4.0]

The challenge wants you to provide characters from 3rd element to the 5th element of the student_gpas list, and python starts numbering from 0 so to slice the list you would:

sliced_gpas = student_gpas[2:5]

Slices work just like using the range function, the first number is the starting point of the slice and the second number is the stopping point but unlike the first number the second number is not included in the range so counting stops before the second number and in our case it would stop at student_gpas[4] which is the 5th element