How can I convert a number to its equivalent in base9 with the caveat that its base9 has no "0" digit.
For example:
Base10 = 0, 1, 2, 3, .. 9, 10, 12 ... 28, 29, 30, ... 62, 63, 64, etc
Base9 = N/A, 1, 2, 3, .. 9, 11, 12 ... 31, 32, 33, ... 68, 69, 71, etc
I want to be able to take a normal decimal number (ex:10) and have it returned in base9 ignoring the 0 place (ex:11).
I'm new to python and programming in general, not to mention my lack of knowledgeable as far as math is concerned, so my first attempt is rather sloppy. It only works on smaller numbers and I have a feeling there's a much easier way to do this.
def base9(x):
count = 0
a = xrange(10,100,9)
while count != x:
if x < a[count]:
return x + count
count += 1
print base9(10)