01 to 3 i think

This commit is contained in:
David Gailleton
2025-12-18 20:27:31 +00:00
parent 01854a4fb7
commit 9818ec9dc6
4 changed files with 64 additions and 0 deletions

23
01/ex1/ft_garden_data.py Normal file
View File

@@ -0,0 +1,23 @@
class Plants:
name: str
height: int
age: int
def __init__(self, name, height, age):
self.name = name
self.height = height
self.age = age
def print_plant(self):
print(self.name.capitalize() + ":", self.height, end="")
print("cm,", self.age, "days old")
if __name__ == "__main__":
x = Plants("rose", 25, 30)
y = Plants("sunflower", 80, 45)
z = Plants("cactus", 15, 120)
print("=== Garden Plant Registry ===")
x.print_plant()
y.print_plant()
z.print_plant()