input: Write a function to optimize a Python algorithm to find the greatest 2 numbers from a 10000 integers list. The function should return the two greatest numbers in the list as a tuple. If the list has fewer than two elements, the function should raise a ValueError.
  
  def get_greatest_2(items):
   if len(items) < 2:
   raise ValueError("The list must contain at least two elements")
   max1 = max2 = float('-inf')
   for item in items:
   if item > max1:
   max1, max2 = item, max1
   elif item > max2:
   max2 = item
   return max1, max2
  
  myList = [1, 5, 3, 7, 4, 7, 8, 9, 2, 10, 6, 8]
  assert get_greatest_2(myList) == (10, 9)
  
  myList = [3, 2, 1]
  assert get_greatest_2(myList) == (3, 2)
  
  myList = [4]
  try:
   get_greatest_2(myList)
   assert False
  except ValueError:
   assert True
output: def get_greatest_2(items):
      if len(items) < 2:
          raise ValueError("The list must contain at least two elements")
      max1 = max2 = float('-inf')
      for item in items:
          if item > max1:
              max1, max2 = item, max1
          elif item > max2:
              max2 = item
      return max1, max2