Corrected ex1, ready to push

This commit is contained in:
2026-01-29 12:18:19 +01:00
parent 6c5ddeebf0
commit acc6d274c2
7 changed files with 279 additions and 111 deletions

View File

@@ -1,22 +1,24 @@
class Plants:
class Plant:
name: str
height: int
days: int
def __init__(self, name, height, days):
def __init__(self, name: str, height: int, days: int) -> None:
"""Init plant with his value"""
self.name = name
self.height = height
self.days = days
def print_plant(self):
print(self.name.capitalize() + ":", self.height, end="")
print("cm,", self.days, "days old")
def print_plant(self) -> None:
"""Display plant informations"""
print(self.name, ": ", self.height,
"cm, ", self.days, " days old", sep="")
if __name__ == "__main__":
x = Plants("rose", 25, 30)
y = Plants("sunflower", 80, 45)
z = Plants("cactus", 15, 120)
x = Plant("rose", 25, 30)
y = Plant("sunflower", 80, 45)
z = Plant("cactus", 15, 120)
print("=== Garden Plant Registry ===")
x.print_plant()
y.print_plant()