Ex1. Documenting a Classclass Animal:
"""
A class used to represent an Animal.
Attributes:
name (str): The name of the animal.
species (str): The species of the animal.
age (int): The age of the animal in years.
"""
def __init__(self, name, species, age):
"""
The constructor for the Animal class.
Parameters:
name (str): The name of the animal.
species (str): The species of the animal.
age (int): The age of the animal in years.
"""
self.name = name
self.species = species
self.age = age
def make_sound(self, sound):
"""
Makes the animal produce a sound.
Parameters:
sound (str): The sound that the animal makes.
Returns:
str: A string indicating the animal's sound.
"""
return f'The {self.species} named {self.name} says {sound}'
print(Animal.__doc__)
print(Animal.__init__.__doc__)
print(Animal.make_sound.__doc__)