push
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
class Plant:
|
||||
def __init__(self, name, height, age):
|
||||
self.name = name
|
||||
self.height = height
|
||||
self.age = age
|
||||
|
||||
|
||||
plant_data = [
|
||||
("Rose", 25, 30),
|
||||
("Oak", 200, 365),
|
||||
("Cactus", 5, 90),
|
||||
("Sunflower", 80, 45),
|
||||
("Fern", 15, 120)
|
||||
]
|
||||
|
||||
index = 0
|
||||
plants = [Plant(name, height, age) for name, height, age in plant_data]
|
||||
|
||||
for p in plants:
|
||||
print(f"Created: {p.name} ({p.height} cm, {p.age} days)")
|
||||
index += 1
|
||||
print(f"\nTotal plants created: {index}")
|
||||
Reference in New Issue
Block a user