20 out of 20 users completed this Bite ...
Will you be Pythonista #21 to crack this Bite?
Average Bite difficulty 1-10 rating: 1.0
» You can do it! 😌
In this Bite you make an iterator called
EggCreatorby implementing the
__next__dunder methods (as dictated by the iterator protocol).
Have it receive an
limitwhich is the max number of eggs to create. It then generates eggs of randomly chosen colors from the
Make sure you raise the right exception when you reach the passed in
So this is how the iterator would work + its output:for egg in EggCreator(5): print(egg)
Would output (colors will vary due to randomness):green egg yellow egg yellow egg blue egg red egg
Eggs theme? Yep, this Bite was produced the 31st of March 2018 - Happy Easter all!
Good luck and keep calm and code in Python!