piscine 00

This commit is contained in:
David Gailleton
2025-12-18 15:39:15 +01:00
parent 029903f8dd
commit 01854a4fb7
9 changed files with 62 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
def ft_hello_garden():
print("Hello, Garden Community!")

6
00/ex1/ft_plot_area.py Normal file
View File

@@ -0,0 +1,6 @@
def ft_plot_area():
print("Enter length:", end=" ")
len = int(input())
print("Enter width:", end=" ")
width = int(input())
print("Plot area: ", len * width)

View File

@@ -0,0 +1,8 @@
def ft_harvest_total():
print("Day 1 harvest:", end=" ")
d1 = int(input())
print("Day 2 harvest:", end=" ")
d2 = int(input())
print("Day 3 harvest:", end=" ")
d3 = int(input())
print("Total harvest:", d1 + d2 + d3)

7
00/ex3/ft_plant_age.py Normal file
View File

@@ -0,0 +1,7 @@
def ft_plant_age():
print("Enter plant age in days:", end=" ")
age = int(input())
if age > 60:
print("Plant is ready to harvest!")
else:
print("Plant needs more time to grow.")

View File

@@ -0,0 +1,7 @@
def ft_water_reminder():
print("Days since last watering:", end=" ")
x = int(input())
if x > 2:
print("Water the plants!")
else:
print("Plants are fine")

View File

@@ -0,0 +1,6 @@
def ft_count_harvest_iterative():
print("Days until harvest:", end=" ")
i = range(1, int(input()) + 1)
for n in i:
print("Day", n)
print("Harvest time!")

View File

@@ -0,0 +1,9 @@
def ft_count_harvest_recursive(x=-1):
if x < 0:
print("Days until harvest:", end=" ")
x = int(input())
ft_count_harvest_recursive(x)
print("Harvest time!")
elif x > 0:
ft_count_harvest_recursive(x - 1)
print("Day", x)

View File

@@ -0,0 +1,8 @@
def ft_garden_summary():
print("Enter garden name:", end=" ")
g_name = input()
print("Enter number of plants:", end=" ")
nb_plants = input()
print("Garden:", g_name)
print("Plants:", nb_plants)
print("Status: Growing well!")

View File

@@ -0,0 +1,9 @@
def ft_seed_inventory(seed_type: str, quantity: int, unit: str) -> None:
if unit == "packets":
print(seed_type.capitalize(), "seeds:", quantity, unit, "available")
elif unit == "grams":
print(seed_type.capitalize(), "seeds:", quantity, unit, "total")
elif unit == "area":
print(seed_type.capitalize(), "seeds:", "covers", quantity, "square meters")
else:
print("Unknown unit type")