class Counter:
def __init__(self, low, high, step):
self.current = low
self.high = high
self.step = step
def __iter__(self):
return self
def __next__(self):
if self.current > self.high:
raise StopIteration
result = self.current
self.current += self.step
return result
for number in Counter(3, 9, 2):
print(f"{number = }")