Creating a Lottery iterator
You've practiced building an iterator, and handling StopIteration exceptions when using an iterator. Now, it's time to put it all together. You'll be building a Lottery iterator to draw integers at random and create a winning number. Happy coding!
Este exercício faz parte do curso
Intermediate Object-Oriented Programming in Python
Exercício interativo prático
Experimente este exercício completando este código de exemplo.
class Lottery:
def __init__(self, number_digits):
self.number_digits = number_digits
self.counter = 0
# Create an iterator using a magic method
def ____(____):
return ____