B. replacelast(L, item): returns a mylist that is same as L, except that the last value is replaced by item.

From EECS 182
B. replacelast(L, item): returns a mylist that is same as L, except that the last value is replaced by item.
Jump to: navigation, search
  1. Problem B: Return a list that is same as L, except that the last value is item.

def replacelast(L, item):

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