Given two indices, i and k, the slice is the list containing the elements between the i'th and k'th element of the original list (both limits included). Start counting the elements with 1
def slice(lst, i, k):
return lst[i-1:k]
def slice(lst, i, k):
return lst[i-1:k]
No comments:
Post a Comment