Python Example | Remove Element from List

This python example code will show us how to remove an item or element from a python list.

array = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
array.remove(40)

array will be:

[10, 20, 30, 50, 60, 70, 80, 90, 100]

We also can use list pop()  function.

index = 3
array.pop(index)

array will be:

[10, 20, 30, 50, 60, 70, 80, 90, 100]

We also can use python del() function.

array = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
index = 3
del array[index]

array will be:

[10, 20, 30, 50, 60, 70, 80, 90, 100]