push
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
class Plant:
|
||||
def __init__(self, name, height, age):
|
||||
self.name = name
|
||||
self.height = height
|
||||
self.age = age
|
||||
self.type = type
|
||||
|
||||
|
||||
class Tree(Plant):
|
||||
def __init__(self, name, height, age, type, diameter, shade):
|
||||
super().__init__(name=name, height=height, age=age)
|
||||
self.diam = diameter
|
||||
self.shade = shade
|
||||
self.type = type
|
||||
|
||||
|
||||
class Flower(Plant):
|
||||
def __init__(self, name, height, age, type, color, bloom):
|
||||
super().__init__(name=name, height=height, age=age)
|
||||
self.color = color
|
||||
self.bloom = bloom
|
||||
self.type = type
|
||||
|
||||
|
||||
class Vegetable(Plant):
|
||||
def __init__(self, name, height, age, type, season, nutrional):
|
||||
super().__init__(name=name, height=height, age=age)
|
||||
self.season = season
|
||||
self.nutrional = nutrional
|
||||
self.type = type
|
||||
|
||||
|
||||
r = Flower("Rose", 25, 30, "Flower", "red", "blooming")
|
||||
o = Tree("Oak", 500, 1825, "Tree", 50, 78)
|
||||
t = Vegetable("Tomato", 80, 90, "Vegatable", "summer",
|
||||
"vitamin C")
|
||||
|
||||
print("=== Garden Plant Types ===\n")
|
||||
print(f"{r.name} ({r.type}): {r.height}cm, {r.age} days, {r.color} color")
|
||||
print(f"{r.name} is {r.bloom} beautifully !\n")
|
||||
print(f"{o.name} ({o.type}): {o.height}cm, {o.age} days, {o.diam}cm diameter")
|
||||
print(f"{o.name} provides {o.shade} square meters of shade\n")
|
||||
print(f"{t.name} ({t.type}): {t.height}cm, {t.age} days, {t.season} harvest")
|
||||
print(f"{t.name} is rich in {t.nutrional}")
|
||||
Reference in New Issue
Block a user