学习中……
Topic source#-*- coding:utf-8 -*-
def cl(n, L=[]):
if n % 2 == 0:
n = n-1
if n == 1:
L = [1]
return L
else:
L = cl(n-2, L)
L.append(n)
return L
#测试
print(cl(10))
print(cl(11))
print(cl(20))
print(cl(21))
[1, 3, 5, 7, 9]
[1, 3, 5, 7, 9, 11]
[1, 3, 5, 7, 9, 11, 13, 15, 17, 19]
[1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21]
- 1
用户5374996158