I'm trying to make a program to convert a number which is in base 6 to decimal(base 10). It doesn't seem to work. Could anyone please help.
a = 75
if a == 0:
return 0
a = str(a)
result = (a[0])
for i in a[:1]:
result *= 6
result += (i)
print result
The result does not work.
Now let's say I try to add 2 base 6 numbers. How do I proceed? I tried to convert each number to base 6 and add them, the answer is not correct. I also tried to add them first and then convert to base 6 but it still doesn't work.
How would I proceed for multiplication as well?
Thanks