def odd(n): return list(range(1, 2*n, 2)) print(odd(10)) print(odd(12))
输出:
[1, 3, 5, 7, 9, 11, 13, 15, 17, 19] [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23]