Starting Python 3.4 there is support for enumerations (not to confuse with the
enumeratebuiltin). You can define a class that inherits from
In this Bite we have some constants that are related: the scores we provide for our Bites depending the level and if cheated. As these variables relate they are an ideal candidate to be refactored into an
Enum. But that would not be much of a Bite, right? So we added two requirements:
- Add a
__str__method so each member would print like this:
BEGINNER => 👍👍, where BEGINNER is the level and the number of thumbs ups the amount of points.
- Write a
averagethat returns an average of the scores in the
See the TESTS tab for more info. You might want to read the Enum docs to see how you can pull this off. We hope it clicks and you find joy coding this one, and of course that you earn your full 👍👍👍 for this INTERMEDIATE Bite. Good luck and have fun!