Python remove elements from two dimensional list

Viewed 8434

Trying to remove min and max values from two dimensional list in array. My code:

myList = [[1, 3, 4], [2, 4, 4], [3, 4, 5]]
maxV = 0
minV = myList[0]0]
for list in myList:
   for innerlist in list:
      if innerlist > maxV:
         maxV = innerlist
      if innerlist < minV:
         minV = innerlist
   innerlist.remove(maxV)
   innerlist.remove(minV)
print(myList)

This causes me some erros, which i not particulary understand. I'm quite sure that innerlist is not array but ordinary variable. But still i think it should be somehow possible to remove min and max elements from two dimensional list. I mean I need to remove in every innerlist in my list highest and lowest values. LF help! Regards.

5 Answers
Related