def num_from_str(s):
    """Return a num computed from a string."""
    try:
        return int(s)
    except ValueError:
        try:
            return float(s)
        except ValueError:
            raise ValueError('Can not convert the string into a numeric value.'
                )
