# William M. Farmer
# min_max.py
# 19 March 2013

class MinMaxException(Exception):
  def __init__(self, x):
    self.list = x
  def __str__(self):
    return str(self.list) + " has no minimum nor maximum."

def minmax(x):
  if x == []:
    raise MinMaxException(x)
  min = x[0]
  max = x[0]
  for i in x:
    if i < min:
      min = i
    if i > max:
      max = i
  return [min,max]