input: Write a python function to swap the first and last elements of a list.
  assert swap([1, 2, 3, 4, 5]) == [5, 2, 3, 4, 1]
  assert swap([10, 20, 30, 40]) == [40, 20, 30, 10]
  assert swap([7, 8, 9]) == [9, 8, 7]
output: def swap(lst):
      if len(lst) > 1:
          lst[0], lst[-1] = lst[-1], lst[0]
      return lst