Need a Python function called tail(x, n) where x is a list and n is an integer.
Fantastic news! We've Found the answer you've been seeking!
Question:
Need a Python function called tail(x, n) where x is a list and n is an integer. This function will return a list that contains the last n items in the input list x . If the list does not have n items, it will return all items. If n is negative or zero, the function will return an empty list.
Related Book For
Introduction to Algorithms
ISBN: 978-0262033848
3rd edition
Authors: Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest
Posted Date: