summaryrefslogtreecommitdiff
path: root/py00/ex6
diff options
context:
space:
mode:
authoryctct <yctct@yctct.com>2026-06-07 08:59:04 +0200
committeryctct <yctct@yctct.com>2026-06-07 08:59:04 +0200
commit15115b4c52bfda0d1cca9fa1155beecbb873ec35 (patch)
treeb3f0975e63eb04dcba732a78ce9bd9abda8acf01 /py00/ex6
First commit, add all files
Diffstat (limited to 'py00/ex6')
-rw-r--r--py00/ex6/ft_count_harvest_iterative.py5
-rw-r--r--py00/ex6/ft_count_harvest_recursive.py14
2 files changed, 19 insertions, 0 deletions
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)