Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 3 additions & 27 deletions ch09-objects/e43b1_legged_animals.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,46 +15,22 @@ def __repr__(self):


class TwoLeggedAnimal(Animal):
def __init__(self, color):
super().__init__(color)
self.number_of_legs = 2

number_of_legs = 2

class FourLeggedAnimal(Animal):
def __init__(self, color):
super().__init__(color)
self.number_of_legs = 4

number_of_legs = 4

class ZeroLeggedAnimal(Animal):
def __init__(self, color):
super().__init__(color)
self.number_of_legs = 0

number_of_legs = 0

class Wolf(FourLeggedAnimal):
"""Class for creating 4-legged wolves of any color"""

def __init__(self, color):
super().__init__(color)


class Sheep(FourLeggedAnimal):
"""Class for creating 4-legged sheep of any color"""

def __init__(self, color):
super().__init__(color)


class Snake(ZeroLeggedAnimal):
"""Class for creating 0-legged snakes of any color"""

def __init__(self, color):
super().__init__(color)


class Parrot(TwoLeggedAnimal):
"""Class for creating 2-legged parrots of any color"""

def __init__(self, color):
super().__init__(color)