Upside-down triangle
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version.
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.
Print a triangle of stars that shrinks: ****, then ***, then **, then *.
Click Run to see the output here.