A. deletelasttwo(L): returns a mylist that contains all but the last two elements of L, in same sequence.

From EECS 182
A. deletelasttwo(L): returns a mylist that contains all but the last two elements of L, in same sequence.
Jump to: navigation, search
  1. Problem A: Return a list that does not contain the last two items in L

def deletelasttwo(L):

   return L.pop().pop()
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox
EECS @ UM
Tools