I want to delete the first element of a list (l[0]) at constant time. I was wondering if del l[0] would do it! If not, is there any other way?
I want to delete the first element of a list (l[0]) at constant time. I was wondering if del l[0] would do it! If not, is there any other way?
There are many ways to delete the first element of a list :
l = l[1:]
or
l.pop(0)
or
del l[0]