For this week's discussion, please write a runnable example code showing inheritance and explain your code.
Example (For reference, doesn't have to be similar.)
CODE
class Dog:
 def __init__(self, first_name, fav_place="Doggy Park"):
  self.first_name = first_name
  self.fav_place = fav_place
 Â
 def bark(self):
  print("WOOF WOOF!!!")
class Puppy(Dog):
 def __init__(self, first_name, fav_place="Living Room", fav_food="puppy snack"):
  self.first_name = first_name
  self.fav_place = fav_place
  self.fav_food = fav_food
  Â
 def bark(self):
  print("woof woof")
spot = Puppy("Spot")
print(spot.first_name + " says ", end="")
spot.bark()
champ = Dog("Champ")
print(champ.first_name + " says ", end="")
champ.bark()
OUTPUT
Spot says woof woof
Champ says WOOF WOOF!!!
EXPLANATION
Dog is the parent class and Puppy is the child class. The parent class is passed as a parameter into the child class.
Puppy class is ove
iding bark method from the parent class to have smaller barks.Â
spot is our Puppy object. champ is our Dog object.
When printed, spot barks with lower cases and champ barks with all caps.
How will this be graded?
If you submitted something before the due date: +2
If you included the runnable example code: +4
If you included an explanation of what's happening in your code: +2
If you commented on 2 other student's posting: +2
Out of a total of 10 points.