code: def pmf(value):
      
      probs = probabilities(value)
      if abs(1.-sum(map(float, value.split()))) > 1e-12:
          raise ValueError('The probabilities %s do not sum up to 1!' % value)
      return [(p, i) for i, p in enumerate(probs)]
docs: Comvert a string into a Probability Mass Function.
  
      :param value:
          a sequence of probabilities summing up to 1 (no commas)
      :returns:
          a list of pairs [(probability, index), ...] with index starting from 0
  
      >>> pmf("0.157 0.843")
      [(0.157, 0), (0.843, 1)]