Skip to content

Positive, negative or zero · ⁨正数、负数还是零⁩

English

Positive, negative or zero

n is -4. Print positive, negative or zero — whichever n is.

Three answers need if, then elif, then else. Python tries them in order and stops at the first one that is true, so the else only runs when both questions above it said no.

中文

正数、负数还是零

n 是 -4。根据 n 的情况,打印 positive、negative 或 zero。

三种答案需要 if、elif、else。Python 按顺序尝试,遇到第一个成立的就停下,所以只有上面两个问题都为“否”时才会走到 else。

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

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