Exercice 5
Ecrire un programme python qui affiche un triangle d'étoiles comme le montre la figure suivante:
Solution
1 2 3 4 5 6 7 8 9 |
number_lines = 20 s = "" for i in range(1 , number_lines): if i <= 10: s = s + "*" print(s) else: s = s[0 : len(s) - 1] print(s) |
Younes Derfoufi
CRMEF OUJDA
1 thought on “Solution Exercice 5: triangle d'étoiles en python”