class RangeException(Exception) : def __init__(self, low, high) : self.low = low self.high = high def __str__(self) : s = "Expected value in range "+str(self.low) s = s + " to " s = s + str(self.high) return s
def CheckValue( inV ) : if ( inV < 0 or inV > 10 ) : raise RangeException(0,10) return True