From 3ed285c70d75ee7a19633df7baaf9732c493a1ad Mon Sep 17 00:00:00 2001 From: Axy Date: Mon, 29 Dec 2025 17:17:02 +0100 Subject: [PATCH] Finished this dumb subject --- .gitignore | 2 ++ ex0/ft_hello_garden.py | 2 ++ ex1/ft_plot_area.py | 4 ++++ ex2/ft_harvest_total.py | 5 +++++ ex3/ft_plant_age.py | 6 ++++++ ex4/ft_water_reminder.py | 6 ++++++ ex5/ft_count_harvest_iterative.py | 5 +++++ ex5/ft_count_harvest_recursive.py | 10 ++++++++++ ex6/ft_garden_summary.py | 6 ++++++ ex7/ft_seed_inventory.py | 10 ++++++++++ 10 files changed, 56 insertions(+) create mode 100644 .gitignore create mode 100644 ex0/ft_hello_garden.py create mode 100644 ex1/ft_plot_area.py create mode 100644 ex2/ft_harvest_total.py create mode 100644 ex3/ft_plant_age.py create mode 100644 ex4/ft_water_reminder.py create mode 100644 ex5/ft_count_harvest_iterative.py create mode 100644 ex5/ft_count_harvest_recursive.py create mode 100644 ex6/ft_garden_summary.py create mode 100644 ex7/ft_seed_inventory.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5d72cc3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +**__pycache__ +**main.py diff --git a/ex0/ft_hello_garden.py b/ex0/ft_hello_garden.py new file mode 100644 index 0000000..9885c07 --- /dev/null +++ b/ex0/ft_hello_garden.py @@ -0,0 +1,2 @@ +def ft_hello_garden(): + print("Hello, Garden Community!") diff --git a/ex1/ft_plot_area.py b/ex1/ft_plot_area.py new file mode 100644 index 0000000..8144b21 --- /dev/null +++ b/ex1/ft_plot_area.py @@ -0,0 +1,4 @@ +def ft_plot_area(): + length: int = int(input("Enter length: ")) + width: int = int(input("Enter width: ")) + print(f"Plot area: {length * width}") diff --git a/ex2/ft_harvest_total.py b/ex2/ft_harvest_total.py new file mode 100644 index 0000000..3508778 --- /dev/null +++ b/ex2/ft_harvest_total.py @@ -0,0 +1,5 @@ +def ft_harvest_total(): + day1: int = int(input("Day 1 harvest: ")) + day2: int = int(input("Day 2 harvest: ")) + day3: int = int(input("Day 3 harvest: ")) + print(f"Total harvest: {day1 + day2 + day3}") diff --git a/ex3/ft_plant_age.py b/ex3/ft_plant_age.py new file mode 100644 index 0000000..9c3e0be --- /dev/null +++ b/ex3/ft_plant_age.py @@ -0,0 +1,6 @@ +def ft_plant_age(): + age: int = int(input("Enter plant age in days: ")) + if age > 60: + print("Plant is ready to harvest!") + else: + print("Plant needs more time to grow.") diff --git a/ex4/ft_water_reminder.py b/ex4/ft_water_reminder.py new file mode 100644 index 0000000..d3490c0 --- /dev/null +++ b/ex4/ft_water_reminder.py @@ -0,0 +1,6 @@ +def ft_water_reminder(): + days: int = int(input("Days since last watering: ")) + if days > 2: + print("Water the plants") + else: + print("Plants are fine") diff --git a/ex5/ft_count_harvest_iterative.py b/ex5/ft_count_harvest_iterative.py new file mode 100644 index 0000000..40b5560 --- /dev/null +++ b/ex5/ft_count_harvest_iterative.py @@ -0,0 +1,5 @@ +def ft_count_harvest_iterative(): + days: int = int(input("Days until harvest: ")) + for day in range(1, days): + print(f"Day {day}") + print("Harvest time!") diff --git a/ex5/ft_count_harvest_recursive.py b/ex5/ft_count_harvest_recursive.py new file mode 100644 index 0000000..90f2602 --- /dev/null +++ b/ex5/ft_count_harvest_recursive.py @@ -0,0 +1,10 @@ +def ft_count_harvest_recursive_in(day: int, days: int): + if day <= days: + print(f"Day {day}") + ft_count_harvest_recursive_in(day + 1, days) + + +def ft_count_harvest_recursive(): + days: int = int(input("Days until harvest: ")) + ft_count_harvest_recursive_in(1, days) + print("Harvest time!") diff --git a/ex6/ft_garden_summary.py b/ex6/ft_garden_summary.py new file mode 100644 index 0000000..0498ff1 --- /dev/null +++ b/ex6/ft_garden_summary.py @@ -0,0 +1,6 @@ +def ft_garden_summary(): + name = input("Enter garden name: ") + plants = input("Enter number of plants: ") + print(f"Garden: {name}") + print(f"Plants: {plants}") + print("Status: Growing well!") diff --git a/ex7/ft_seed_inventory.py b/ex7/ft_seed_inventory.py new file mode 100644 index 0000000..3fa7481 --- /dev/null +++ b/ex7/ft_seed_inventory.py @@ -0,0 +1,10 @@ +def ft_seed_inventory(variety: str, quantity: int, unit: str): + prefix = f"{variety.capitalize()} seeds:" + if unit == "packets": + print(f"{prefix} {quantity} packets available") + elif unit == "grams": + print(f"{prefix} {quantity} grams total") + elif unit == "area": + print(f"{prefix} covers {quantity} quare meters") + else: + print("Unknown unit type") -- 2.51.0