From 5467481626eeab4bb294b4856ae2b365c8458f1e Mon Sep 17 00:00:00 2001 From: Tipragot Date: Thu, 21 Sep 2023 15:09:01 +0200 Subject: [PATCH] Exercices --- Chapitre 2 - Récursivité/exercices.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Chapitre 2 - Récursivité/exercices.py diff --git a/Chapitre 2 - Récursivité/exercices.py b/Chapitre 2 - Récursivité/exercices.py new file mode 100644 index 0000000..1a5c342 --- /dev/null +++ b/Chapitre 2 - Récursivité/exercices.py @@ -0,0 +1,17 @@ +def rebours(n): + if n == 0: + print() + return + print(n, end=" ") + rebours(n-1) + +rebours(12) + +def compte(t, n=1): + print(n, end=" ") + if n < t: + compte(t, n+1) + else: + print() + +compte(5)