fork download
  1. class Nomes:
  2. def __init__(self, lista):
  3. self.lista = lista
  4. self.list_iter= iter(lista)
  5.  
  6. def __iter__(self):
  7. return self
  8.  
  9. def __next__(self):
  10. return next(self.list_iter)
  11.  
  12. lista_de_nomes = Nomes(['marcos', 'felipe', 'lucas'])
  13.  
  14. for nome in lista_de_nomes:
  15. print(nome)# your code goes here
Success #stdin #stdout 0.02s 9028KB
stdin
Standard input is empty
stdout
marcos
felipe
lucas