C. lookup(L, k): return the kth item in the mylist, where indexing starts at 0.
From EECS 182
C. lookup(L, k): return the kth item in the mylist, where indexing starts at 0.
- Problem C: return the kth item in L. k starts at 0.
- lookup(mylist().append(4).append(3), 1) should be 3
def lookup(L, k):
return L[k:k+1].last()
- You should try doing the problem without the benefit of the indexing operation as well. It is possible to do it with only using last() and pop().