code: def FloatBetweenZeroAndOne(x):
      
      x = float(x)
      if 0 <= x <= 1:
          return x
      else:
          raise ValueError("{0} not a float between 0 and 1.".format(x))
docs: Returns *x* only if *0 <= x <= 1*, otherwise raises error.