Skip to content

Upside-down triangle · ⁨倒三角形⁩

English

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.

中文

倒三角形

打印四行星星,从四颗开始,到一颗结束。

range 用负数步长就能倒着数:range(3, 0, -1) 给出 3、2、1。它仍然在第二个数之前停下,所以终止值写 0。

Log in or create account · ⁨登录或创建账户⁩

IGCSE, A-Level · ⁨IGCSE、A-Level⁩ & AP · ⁨与 AP⁩