Python学习:递归法编写提取一个数字的各个位上的数字并以列表的形式输出
result = []
def get_digits(n):
if n > 0:
result.insert(0,n%10) #从列表头开始插入
get_digits(n
Python学习:递归法编写提取一个数字的各个位上的数字并以列表的形式输出
result = []
def get_digits(n):
if n > 0:
result.insert(0,n%10) #从列表头开始插入
get_digits(n