Question: I would like to know how to do an equivalent of the range function in python, but with the ability to specify the base number. For example:

```
countUp(start=0, end=1010, base=2)
countUp(start=0, end=101, base=3)
countUp(start=0, end=22, base=4)

```

Example output for base 2 counting:

```
[0, 1, 10, 11, 100, ...]

```

Is there a function I'm missing that does this? Or what could I do instead?

Answer: 
You are apparently confusing numbers with the representation of numbers.

A number does not have a base... it's the number **representation** that has a base... for example the number represented as "101" in base 2 is the same as the number represented with "5" in base 10.

The `range` function will count successive numbers, and you can get their representation in any base you like with something like:

```
digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"

def int2str(x, base):
    if x < 0:
        return "-" + int2str(-x, base)
    return ("" if x < base else int2str(x//base, base)) + digits[x % base]

```
You could do this with the itertools [product](https://docs.python.org/3/library/itertools.html#itertools.product) function.

```py
from itertools import product

def countUp(start, end, base):
    n_digits = len(end)
    combs = product(*[range(base)] * n_digits)
    while (n := next(combs)) <= end:
        yield n

list(countUp(start=0, end=(2, 0), base=3))
[(0, 0), (0, 1), (0, 2), (1, 0), (1, 1), (1, 2), (2, 0)]

```