Use this Bird class - i.e. a blueprint for creating Bird objects and using them - to answer questions #1 and #2. class Bird: animal_class = 'Aves' animal_phyla = "Chordata" lays_eggs = True def __init__(self, name, species, color): self.species = species self.name = name self.color = color def get_species(self): return self.species def getting_older(self, yrs): self.age = self_age + yrs def fly(self): print("Now I'm flying") def camouflage(self): print("Blending in with a " + str(self.color) + " environment") def sing(self): print("Tweet Tweet") Which function call below will define a object of the Bird class with name "Audrey", species "Red Robin", and color "red", assigned to the 'my_bird' variable name? a) my_bird = Red_Robin("Audrey") b) my_bird = Red_Robin(Bird("Audrey")) c) my_bird = Bird("Audrey", "Red Robin", "red") d) my_bird = Bird("Red Robin", "Audrey", "red") e) my_bird = Bird("Audrey") 2) What line of code calls the sing method on my_bird and what does this method return? a) sing(my_bird), None b) my_bird.sing(), None c) Bird.sing(my_bird), None d) my_bird.sing(), "Tweet Tweet" e) sing(my_bird), "Tweet Tweet"
Use this Bird class - i.e. a blueprint for creating Bird objects and using them - to answer questions #1 and #2.
class Bird:
animal_class = 'Aves'
animal_phyla = "Chordata"
lays_eggs = True
def __init__(self, name, species, color):
self.species = species
self.name = name
self.color = color
def get_species(self):
return self.species
def getting_older(self, yrs):
self.age = self_age + yrs
def fly(self):
print("Now I'm flying")
def camouflage(self):
print("Blending in with a " + str(self.color) + " environment")
def sing(self):
print("Tweet Tweet")
Which function call below will define a object of the Bird class with name "Audrey", species "Red Robin", and color "red", assigned to the 'my_bird' variable name?
a) my_bird = Red_Robin("Audrey")
b) my_bird = Red_Robin(Bird("Audrey"))
c) my_bird = Bird("Audrey", "Red Robin", "red")
Step by step
Solved in 2 steps