Room light monitoring project frame size

isn’t the line of code written in the course to delete the extra records as shown:
del history_data[0:len(history_data)-frame_size]

shouldn’t the above be like the below:
del history_data[0:len(history_data)-frame_size-1]

as if we use the former line of code there would be frame_size-1 elements left in history_data but we want elements equal to frame_size in history_data?

del history_data[0:len(history_data)-frame_size] is the correct line as you are going to delete frame_size no. of elements from length of history_data.
Think twice!!

The code line del history_data[0:len(history_data)-frame_size] is the correct one because when we call the len function it returns the number of elements in the list.
Here when we consider an example when there is the empty list so, len(history_data) will be 0 and frame size is considered as 10 ( we want frame size of z analysis is 10 previous element ) so len(history_data)-frame_size will be 0-10 = -10 then it del function delete the elements from history_data[0:-10] i.e. no element will be deleted because history_data does not include the elements from 0 to -10.
here when we consider the list with 11 elements len function return 11 so len(history_data)-frame_size will be 1 after when del history_data[0:1] is executing it will delete the first element only and history data then contains only 10 elements which are equal to frame size.
according to your code, if we write code as del history_data[0:len{history_data]-frame_size-1]) after its executing history data only contains 9 previous elements ( one less than frame size ).
hope you will understand