Archives de
Tag: fonction

La création de fonctions avec paramètre(s) ou argument(s) ayant des valeurs par défaut

La création de fonctions avec paramètre(s) ou argument(s) ayant des valeurs par défaut

>>> def table (nbre, debut = 4, fin = 8): i = debut while i >> table (5) 4 X 5 = 20 5 X 5 = 25 6 X 5 = 30 7 X 5 = 35 8 X 5 = 40 >>> def table (nbre, debut = 4, fin = 8): i = debut while i >> table (5, 6, 9) 6 X 5 = 30 7 X 5 = 35 8 X 5 = 40 9 X…

Lire la suite Lire la suite

La création de fonctions avec paramètre(s) ou argument(s)

La création de fonctions avec paramètre(s) ou argument(s)

Voir théorie dans l’article suivant : La création d’une fonction sans paramètre ou argument + espaces de noms global et local >>> def table (nbre): i = 1 while i <= 10 : print (i, « X », nbre, « = », i*nbre) i = i + 1 >>> table (5) 1 X 5 = 5 2 X 5 = 10 3 X 5 = 15 4 X 5 = 20 5 X 5 = 25 6 X 5 = 30 7 X 5 =…

Lire la suite Lire la suite