How to Remove an Element From Array in Python


In this example we will show how to remove an element from the array using the remove() method in Python.

Source Code

letter = ['a', 'b', 'c', 'd']
print(letter)
letter.remove('c')
print(letter)

Output:

['a', 'b', 'c', 'd']
['a', 'b', 'd']
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments

How to Remove an Element From Array in Python


In this example we will show how to remove an element from the array using the pop() method in Python.

Source Code

letter = ['a', 'b', 'c', 'd']
print(letter)
letter.pop(2)
print(letter) 

Output:

['a', 'b', 'c', 'd']
['a', 'b', 'd']
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments