13

 avatar
unknown
plain_text
3 years ago
302 B
5
Indexable
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)
Editor is loading...