Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/Jack-Lee-Hiter/AlgorithmsByPython
/ toStr
Function
toStr
Recursion.py:20–25 ·
view source on GitHub ↗
(n,base)
Source
from the content-addressed store, hash-verified
18
19
# 递归实现进制转换:
20
def
toStr(n,base):
21
convertString =
"0123456789ABCDEF"
22
if
n < base:
23
return
convertString[n]
24
else
:
25
return
toStr(n//base, base) + convertString[n%base]
26
27
print(toStr(1453, 16))
28
Callers
1
Recursion.py
File · 0.85
Calls
no outgoing calls
Tested by
no test coverage detected