13
unknown
plain_text
2 years ago
302 B
2
Indexable
Never
class CustomerCounter: def __iter__(self): self.count = 0 return self def __next__(self): self.count +=1 if self.count > 5: raise StopIteration return self.count customer_counter = CustomerCounter() for customer_count in customer_counter: print(customer_count)