Join Regular Classroom : Visit ClassroomTech

Python Array – delete the first item of the array

del function – del list[index]

Here is an example for you

# Python code to understand how to delete first item of the array
# www.codewindow.in

c=[10,11,12,13,14]

#using del method
del c[0]
print(c)
Don’t know how to pop the first element of the array in python? Read: Python array – pop the first element of the array

Output:

[11, 12, 13, 14]

Explanation:
Here, del c[0] deletes the first element indexed at 0 i.e. the first element.


You Missed

Also Checkout