Ajout bbas

This commit is contained in:
Tipragot 2023-10-04 10:39:06 +02:00
parent 701101383f
commit f1daf341ec
No known key found for this signature in database

View file

@ -78,7 +78,12 @@ def bhaut(n: int):
print("*" * n) # On affiche n points print("*" * n) # On affiche n points
bhaut(n-1) # On fait appel à la fonction avec n-1 points pour afficher la ligne suivante bhaut(n-1) # On fait appel à la fonction avec n-1 points pour afficher la ligne suivante
def pair(n: int) -> bool: def bbas(n: int):
if n == 0: return # Si n est égal a 0 on ne fais rien
bbas(n-1) # On fait appel à la fonction avec n-1 points pour afficher la ligne suivante
print("*" * n) # On affiche n points
def pair(n: int) -> bool:
""" """
Fonction récursive qui renvoie True si n est pair et False sinon. Fonction récursive qui renvoie True si n est pair et False sinon.
""" """
@ -86,7 +91,7 @@ def bhaut(n: int):
return True # On renvoie True pour dire que c'est pair return True # On renvoie True pour dire que c'est pair
return impair(n-1) # Sinon on fait appel à la fonction impair avec n-1 return impair(n-1) # Sinon on fait appel à la fonction impair avec n-1
def impair(n: int) -> bool: def impair(n: int) -> bool:
""" """
Fonction récursive qui renvoie True si n est impair et False sinon. Fonction récursive qui renvoie True si n est impair et False sinon.
""" """