Exercices
This commit is contained in:
parent
99e28efdd7
commit
5467481626
17
Chapitre 2 - Récursivité/exercices.py
Normal file
17
Chapitre 2 - Récursivité/exercices.py
Normal file
|
@ -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)
|
Loading…
Reference in a new issue