Remove several elements of list by index


To remove an element by its index, use the slice syntax:

examples/lists/remove_by_slice.py
names = ['foo', 'bar', 'baz', 'moo', 'qux']

names[2:4] = []
print(names)    # ['foo', 'bar', 'qux']