8 lines
146 B
Python
8 lines
146 B
Python
def odd(n: int):
|
|
for i in range(1, n + 1, 2):
|
|
yield i
|
|
|
|
|
|
# Test
|
|
print(list(odd(7))) # [1, 3, 5, 7]
|
|
print(list(odd(8))) # [1, 3, 5, 7] |