Coding task · Python course · Module 3: Object-Oriented Programming

Class Method

Create a class method

Task

Create a @classmethod from_dict(cls, data) that creates an Animal from a dictionary with the keys 'name' and 'species', e.g. Animal.from_dict({'name': 'Simba', 'species': 'Lion'})