9/18 Reversing A List


Why does "backwards=my_list[10:0:-1]" not work? Can someone explain why?


Your range goes from the start number (10) to (but not including!!!) your stop number (0). To fix this you could write [10::-1] and it will go from 10 until it reaches the end (in this case 0) or even [::-1] for the entire range.


How about if I did it "backwards=my_list[10:-1:-1]?


You can't use -1 for an index


But how then does doing "backwards=[::-1]" accomplish this without assuming that the end position is -1?


print backwards