for example i have a list
mylist=[[1,2],[5,8],[-9,2],[0,-9],[4,0],[0,-4],[-1,-1]]
to remove [-9,2] is by
mylist.remove([-9,2])
i want to use .remove() by using the value of list[2] which is equal to [-9,2] like this
mylist.remove(list[2])
but it will give a none value is there any alternative to this because i am looping the value of the index >> list[value changing per loop]. how can i solve this?
this is the loop
for p in range (len(mylist)):
if mylist[p]==startpoint:
continue
if mylist[p]==nextpoint:
continue
thirdpoint=mylist[p]
print ('the thirdpoint is:',thirdpoint)
if orient(startpoint[0],startpoint[1],nextpoint[0],nextpoint[1],thirdpoint[0],thirdpoint[1])>0:
print ('ok')
print(mylist)
print ('the thirdpoint is:',thirdpoint)
templist=mylist.remove(mylist[p])
print ('templist is',templist)
if len(templist)==2:
print('append nextpoint:',nextpoint)
ppoint.append(nextpoint)