Hello I am trying to remove first and last 2 element of my list.
My list is: ['12','30','22','06','27','13','23','16','14','20','09','29','23']
and this is the code I am using:
dList.remove(dList[0])
dList.remove(dList[-1])
dList.remove(dList[-1])
It works right too many other list but in this list it returns:
['30', '22', '06', '27', '13', '16', '14', '20', '09', '29']
Instead of;
['30', '22', '06', '27', '13', '23', '16', '14', '20', '09',]
I noticed the last element is '23' and both '23' be removed but I don't know how to fix it. It should be work right because I remove first element, and last element, and last element again. I didn't use:
a = dList[0]
dList.remove(a)
a = dList[-1]
dList.remove(a)
a = dList[-1]
dList.remove(a)