8000 GitHub - Veloma11/TIGERS: Compare liones and tigers
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Veloma11/TIGERS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

TIGERS

Compare liones and tigers class Animal: def init(self, species, habitat, weight, diet, lifespan): self.species = species self.habitat = habitat self.weight = weight self.diet = diet self.lifespan = lifespan

def display_info(self):
    print(f"Species: {self.species}")
    print(f"Habitat: {self.habitat}")
    print(f"Weight: {self.weight} kg")
    print(f"Diet: {self.diet}")
    print(f"Lifespan: {self.lifespan} years")
    print()

class Lion(Animal): def init(self): super().init( species="Lion", habitat="Savannah, Grasslands", weight=190, # Average weight for male lions diet="Carnivorous", lifespan=12 # Average lifespan in the wild )

class Tiger(Animal): def init(self): super().init( species="Tiger", habitat="Forests, Grasslands", weight=220, # Average weight for male tigers diet="Carnivorous", lifespan=15 # Average lifespan in the wild )

def compare_animals(animal1, animal2): print("Comparing two animals:") animal1.display_info() animal2.display_info()

lion = Lion() tiger = Tiger()

compare_animals(lion, tiger)

About

Compare liones and tigers

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0