From 15115b4c52bfda0d1cca9fa1155beecbb873ec35 Mon Sep 17 00:00:00 2001 From: yctct Date: Sun, 7 Jun 2026 08:59:04 +0200 Subject: First commit, add all files --- py00/ex0/ft_hello_garden.py | 2 ++ py00/ex1/ft_garden_name.py | 4 ++++ py00/ex2/ft_plot_area.py | 6 ++++++ py00/ex3/ft_harvest_total.py | 5 +++++ py00/ex4/ft_plant_age.py | 6 ++++++ py00/ex5/ft_water_reminder.py | 6 ++++++ py00/ex6/ft_count_harvest_iterative.py | 5 +++++ py00/ex6/ft_count_harvest_recursive.py | 14 ++++++++++++++ py00/ex7/ft_seed_inventory.py | 10 ++++++++++ 9 files changed, 58 insertions(+) create mode 100644 py00/ex0/ft_hello_garden.py create mode 100644 py00/ex1/ft_garden_name.py create mode 100644 py00/ex2/ft_plot_area.py create mode 100644 py00/ex3/ft_harvest_total.py create mode 100644 py00/ex4/ft_plant_age.py create mode 100644 py00/ex5/ft_water_reminder.py create mode 100644 py00/ex6/ft_count_harvest_iterative.py create mode 100644 py00/ex6/ft_count_harvest_recursive.py create mode 100644 py00/ex7/ft_seed_inventory.py (limited to 'py00') diff --git a/py00/ex0/ft_hello_garden.py b/py00/ex0/ft_hello_garden.py new file mode 100644 index 0000000..9885c07 --- /dev/null +++ b/py00/ex0/ft_hello_garden.py @@ -0,0 +1,2 @@ +def ft_hello_garden(): + print("Hello, Garden Community!") diff --git a/py00/ex1/ft_garden_name.py b/py00/ex1/ft_garden_name.py new file mode 100644 index 0000000..a0259b5 --- /dev/null +++ b/py00/ex1/ft_garden_name.py @@ -0,0 +1,4 @@ +def ft_garden_name(): + var = input("Enter garden name: ") + print("Garden: " + var) + print("Status: Growing well!") diff --git a/py00/ex2/ft_plot_area.py b/py00/ex2/ft_plot_area.py new file mode 100644 index 0000000..1ea6d1a --- /dev/null +++ b/py00/ex2/ft_plot_area.py @@ -0,0 +1,6 @@ +def ft_plot_area(): + length = input("Enter length: ") + length = int(length) + width = input("Enter width: ") + width = int(width) + print("Plot area: ", length * width) diff --git a/py00/ex3/ft_harvest_total.py b/py00/ex3/ft_harvest_total.py new file mode 100644 index 0000000..d01db24 --- /dev/null +++ b/py00/ex3/ft_harvest_total.py @@ -0,0 +1,5 @@ +def ft_harvest_total(): + one = int(input("Day 1 harvest: ")) + two = int(input("Day 2 harvest: ")) + three = int(input("Day 3 harvest: ")) + print("Total harvest :", one + two + three) diff --git a/py00/ex4/ft_plant_age.py b/py00/ex4/ft_plant_age.py new file mode 100644 index 0000000..b2d645b --- /dev/null +++ b/py00/ex4/ft_plant_age.py @@ -0,0 +1,6 @@ +def ft_plant_age(): + age = 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/py00/ex5/ft_water_reminder.py b/py00/ex5/ft_water_reminder.py new file mode 100644 index 0000000..2f456ed --- /dev/null +++ b/py00/ex5/ft_water_reminder.py @@ -0,0 +1,6 @@ +def ft_water_reminder(): + day = int(input("Days since last watering: ")) + if day > 2: + print("Water the plants!") + else: + print("Plants are fine") diff --git a/py00/ex6/ft_count_harvest_iterative.py b/py00/ex6/ft_count_harvest_iterative.py new file mode 100644 index 0000000..23c6657 --- /dev/null +++ b/py00/ex6/ft_count_harvest_iterative.py @@ -0,0 +1,5 @@ +def ft_count_harvest_iterative(): + count = int(input("Days until harvest: ")) + for i in range(1, count + 1, + 1): + print("Days ", i) + print("Harvest time!") diff --git a/py00/ex6/ft_count_harvest_recursive.py b/py00/ex6/ft_count_harvest_recursive.py new file mode 100644 index 0000000..f25372b --- /dev/null +++ b/py00/ex6/ft_count_harvest_recursive.py @@ -0,0 +1,14 @@ +def ft_print_days(days, count): + if days > 0: + print("Day:", count) + count += 1 + days -= 1 + ft_print_days(days, count) + else: + print("Harvest time!") + + +def ft_count_harvest_recursive(): + days = int(input("Days until harvest: ")) + count = 1 + ft_print_days(days, count) diff --git a/py00/ex7/ft_seed_inventory.py b/py00/ex7/ft_seed_inventory.py new file mode 100644 index 0000000..5c76e0e --- /dev/null +++ b/py00/ex7/ft_seed_inventory.py @@ -0,0 +1,10 @@ +def ft_seed_inventory(seed_type: str, quantity: int, unit: str) -> None: + seed_type = seed_type.capitalize() + if unit == "packets": + print(seed_type + " seeds: " + str(quantity) + " packets available") + elif unit == "grams": + print(seed_type + " seeds: " + str(quantity) + " grams total") + elif unit == "area": + print(seed_type + " seeds: covers " + str(quantity) + " square meters") + else: + print("Unknown unit type") -- cgit v1.2.3