<gh_stars>0
'''
Given an array of ints, return a new array length 2 containing the first and
 last elements from the original array. The original array will be length 1 or more.

make_ends([1, 2, 3]) → [1, 3]
make_ends([1, 2, 3, 4]) → [1, 4]
make_ends([7, 4, 6, 2]) → [7, 2]
'''
def make_ends(nums):
  if len(nums) < 1:
    return 0
  elif len(nums) == 1:
    nums.append(nums[0])
    return nums
  del nums[1:len(nums) - 1]
  return nums

'''
Given an array of ints, return a new array length 2 containing the first and
 last elements from the original array. The original array will be length 1 or more.

make_ends([1, 2, 3]) → [1, 3]
make_ends([1, 2, 3, 4]) → [1, 4]
make_ends([7, 4, 6, 2]) → [7, 2]
'''
def make_ends(nums):
  if len(nums) < 1:
    return 0
  elif len(nums) == 1:
    nums.append(nums[0])
    return nums
  del nums[1:len(nums) - 1]
  return nums
Given an array of ints, return a new array length 2 containing the first and  last elements from the original array. The original array will be length 1 or more.  make_ends([1, 2, 3]) → [1, 3] make_ends([1, 2, 3, 4]) → [1, 4] make_ends([7, 4, 6, 2]) → [7, 2]