Python Programming - Classes - Discussion

Discussion Forum : Classes - General Questions (Q.No. 44)
44.
Consider the following Python code:
class Animal:
    def __init__(self, species):
        self.species = species

# Create an instance of the Animal class
my_animal = Animal("Lion")
# What does the 'my_animal.species' represent?
Animal class
Lion class
An individual animal object
A specific species of animal
Answer: Option
Explanation:
'my_animal.species' represents the specific species attribute of the individual animal object.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.