How to slice a list from an element n to the end in python? How to slice a list from an element n to the end in python? python python

How to slice a list from an element n to the end in python?


You can leave one end of the slice open by not specifying the value.

test[3:] = [3, 4, 5, 6, 7, 8, 9]test[:3] = [0, 1, 2]


If you're using a variable as the range endpoint, you can use None.

 start = 4 end = None test[start:end]