Login and get codingStarting Python 3.4 there is support for enumerations (not to confuse with the
enumerate
builtin). You can define a class that inherits fromEnum
.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
classmethod
calledaverage
that returns an average of the scores in theEnum
.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!
Will you be the 154th person to crack this Bite?
Resolution time: ~31 min. (avg. submissions of 5-240 min.)
Our community rates this Bite 3.17 on a 1-10 difficulty scale.
» You can do it! 😌