Files
Function/aufgaben/einstellung/Pr_5/pr/ungeradezahlen.py
T
2026-11-17 11:23:05 +01:00

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]