Question: Please use Python 3 to solve this problem. Write a recursive function to convert any decimal number into any base from 2 to 9. See
Please use Python 3 to solve this problem.
Write a recursive function to convert any decimal number into any base from 2 to 9. See the template and I/O examples below for details. If your function isn't recursive, then you will not get credit.
Your function should only be about a half-dozen lines and there must not be any loops anywhere in your code.
One part of the problem is to figure out what the base case is.
Also note that the answer is printed to the screen, not returned as a value.
given code
def main():
n = int(input())
b = int(input())
print(n, "in base", b, "is ", end="")
toBase(n, b)
if __name__ == "__main__":
main()
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
