I'm trying to make a function that takes in a number in base 10 and can be changed to any base from 2 though 9. I'm trying to only use the math
module and just some simple math.
My code involves strings and I would like to eliminate them, and instead have the function do some math instead of using the numbers in a string. Also I'm trying to make the output integers.
def conver(n,b):
digits = ('0123456789')
ans = ""
while n > 0:
ans = digits[n%b] + ans
n //= b
return ans
For example the user could in put in the values (14,2) and get the output 1110