Integer to base-x system using recursion in python

前端 未结 5 1439
甜味超标
甜味超标 2021-01-25 01:21

I am trying to write a recursive code that can convert a number to any base system. for example, the integer 10 into binary would convert to 1010

So far I have this but

5条回答
  •  迷失自我
    2021-01-25 02:19

    The convert function returns None, and print prints it. You should either remove the print call, or accumulate the result as a string and return it.

    (I'm assuming that the call to base is actually meant to be a recursive call to convert.)

提交回复
热议问题