What are they? Raymond Hettinger summarized it nicely in his great talk: a mutible named tuple with defaults.
One advantage is the code it saves you typing so they might become an essential part of your Python toolkit!
In this Bite we have you write a data class called
Bitethat managed 3 attributes: number, title, and level. Their types are
There are 3 more requirements:
- title needs to be capitalized upon instantiation (you get a hint in the tests for this one :) - make sure to read the tests for additonal specs, including some of the differences between
data classes and
- level takes a default argument of Beginner.
- A collection of Bite instances needs to be orderable (using
sorted- this is not by default but configurable ...)
Good luck and keep up with the language, exciting new things are getting added!
On that note feel free to make us more Bite requests via our Bites homepage (you'll find a form per Bite level at the bottom of the page ...)
26 out of 26 users completed this Bite.
Will you be Pythonista #27 to crack this Bite?
It takes an average of ~55 minutes to solve this Bite (submissions 5-240 min).
Pythonistas rate this Bite 2.0 on a 1-10 difficulty scale.
» You can do it! 😌