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.
- 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)