Upside-down triangle · Triangle inversé
Upside-down triangle
Print four rows of stars, starting with four and ending with one.
range counts backwards with a negative step: range(3, 0, -1) gives 3, 2, 1. It still stops before its second number, which is why the stop value is 0.
Triangle inversé
Imprimez quatre rangées d'étoiles, en commençant par quatre et en finissant par une.
range compte à rebours avec un pas négatif : range(3, 0, -1) produit 3, 2, 1. Il s'arrête toujours avant son deuxième argument, c'est pourquoi la valeur d'arrêt est 0.
Print a triangle of stars that shrinks: ****, then ***, then **, then *. · Imprimez un triangle d'étoiles qui rétrécit : ****, puis ***, puis **, puis *.
Click Run to see the output here. · Cliquez sur Exécuter pour voir le résultat ici.