import random


def blood_pressure_depending_on_age(age):
  """Randomly generate a blood pressure value depending upon the given age
     value.

     It is assumed that for a given age value the blood pressure is normally
     distributed with an average blood pressure of 75 at birth (age 0) and of
     90 at age 100, and standard deviation in blood pressure of 4.
  """

  if ((not isinstance(age, int)) and (not isinstance(age, float))):
    raise Exception( 'Age value given is not a number: %s' % (str(age)))

  if (age < 0) or (age > 130):
    raise Exception( 'Age value below 0 or above 130 given')

  avrg_bp = 75.0 + age/100.0

  std_dev_bp = 4.0

  bp = random.normalvariate(avrg_bp, std_dev_bp)

  if bp < 0.0:
    bp = 0.0
    print( 'Warning, blood pressure value of 0.0 returned!')

  return bp