arrays - Does Python perform Bound Checking? -


so, i'm reading code on website (python code):

solution problem: best time buy & sell iii (leetcode)

and wonder why in line 19, python didn't give bound checking errors.

thank you!

line 19:

ed = prices[-1] 

in python, list (array) index of -1 means last element in list definition. not out of bounds, hence no error.