1. 学习
  2. /
  3. 课程
  4. /
  5. Intermediate Object-Oriented Programming in Python

Connected

练习

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!

说明 1 / 共 3 个

undefined XP
    1
    2
    3
  • Define a magic method that returns a reference to the object, making the Lottery class an iterator.