mirror of
https://github.com/DavidGailleton/42-Piscine_Python.git
synced 2026-04-28 16:14:35 +02:00
piscine 00
This commit is contained in:
@@ -0,0 +1,2 @@
|
|||||||
|
def ft_hello_garden():
|
||||||
|
print("Hello, Garden Community!")
|
||||||
@@ -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)
|
||||||
@@ -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)
|
||||||
@@ -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.")
|
||||||
@@ -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")
|
||||||
@@ -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!")
|
||||||
@@ -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)
|
||||||
@@ -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!")
|
||||||
@@ -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")
|
||||||
Reference in New Issue
Block a user