# 使用递归编写一个十进制转换二进制的函数(要求采用“取2取余”的方式,结果与调用的bin()一样返回字符串形式
def Dec2Bin(dec):
result = ''
if dec:
result = Dec2Bin(dec//2)
return result + str(dec%2)
else:
return result
print(Dec2Bin(62))

相关文章:

  • 2021-12-04
  • 2021-09-10
  • 2021-08-11
  • 2022-12-23
  • 2021-12-04
  • 2021-04-28
猜你喜欢
  • 2021-04-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-04
  • 2021-10-15
  • 2022-01-09
相关资源
相似解决方案