first_and_last(items) that returns a tuple (first, last) containing the first and last elements of the list items. Use negative indexing for the last element. Assume items is never empty.items = [10, 20, 30, 40]
(10, 40)
items[0] is 10, items[-1] is 40.
items = [7]
(7, 7)
A single-element list has the same first and last value.
items[0] gets the first element.
items[-1] gets the last element without knowing the length.