Compare commits

..

No commits in common. "1e03bb170f33a350d8faf7e3eb3a9a15ff303016" and "14f60e7396411d664dae12852512b4ed822d3d55" have entirely different histories.

View File

@ -1,59 +0,0 @@
class Dog:
amount_of_dogs = 0
name: str
race: str
age: int
weight: float
bark_sound: str
def __init__(
self, name: str, race: str, age: int, weight: float, bark_sound: str
) -> None:
self.name = name
self.race = race
self.age = age
self.weight = weight
self.bark_sound = bark_sound
Dog.amount_of_dogs += 1
def __str__(self):
return f"{self.name} is a {self.age} year old {self.race}"
def bark(self, times: int = 1) -> str:
return f"{self.name} says:" + (f" {self.bark_sound}" * times)
def birthday(self) -> str:
self.age += 1
return f"Happy Birthday, {self.name}! You're now {self.age} years old!"
def is_puppy(self) -> bool:
return self.age < 2
class Shepperd(Dog):
race: str = "shepperd"
bark_sound: str = "Woo!"
def __init__(self, name: str, age: int, weight: float) -> None:
Dog.__init__(self, name, Shepperd.race, age, weight, Shepperd.bark_sound)
class Poodle(Dog):
race: str = "poodle"
bark_sound: str = "Wow!"
def __init__(self, name: str, age: int, weight: float) -> None:
Dog.__init__(self, name, Poodle.race, age, weight, Poodle.bark_sound)
dog1 = Shepperd("Bello", 5, 22.5)
print(dog1)
print(dog1.bark())
print(dog1.birthday())
print(Dog.amount_of_dogs)
dog2 = Poodle("Barky", 10, 20)
print(dog2.bark(3))
print(dog2.is_puppy())
print(Dog.amount_of_dogs)