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

![[App intégrée] 2025 Upgraded Vidéoprojecteur 1920 * 1080P FHD 4K Mini Projecteur Portable Dual Contrôle avec Souris Android TV WiFi 6 BT5.2 180° Rotation Compatible avec HDMI/TV Stick/USB](https://www.tresfacile.net/wp-content/uploads/2025/12/Videoprojecteur-1920-1080P-FHD-4K-Mini-Projecteur-Portable-Dual-Control-250x236.png)

1 thought on “Solution Exercice 5: triangle d'étoiles en python”