You can input any base number up to base 36:
int(number, base)
Example:
>>> int("AZ14", 36)
511960
If you are talking about limiting the range of a base ten number, here's an example of that:
>>> the_clamps = lambda n, i, j: i if n < i else j if n > j else n
>>> for n in range(0, 10): print((the_clamps(n, 4, 8)))
...
4
4
4
4
4
5
6
7
8
8
>>>
Amendment:
To generate and handle errors:
>>> def mayhem(n, i, j):
... if n < i or n > j: raise Exception("Out of bounds: %i." % n)
... else: return n
...
>>> for n in range(10):
... try: print((mayhem(n, 4, 8)))
... except Exception as e: print((e))
...
Out of bounds: 0.
Out of bounds: 1.
Out of bounds: 2.
Out of bounds: 3.
4
5
6
7
8
Out of bounds: 9.