mirror of
https://github.com/DavidGailleton/42-Piscine_Python.git
synced 2026-01-27 01:01:59 +00:00
24 lines
547 B
Python
24 lines
547 B
Python
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()
|