Positive, negative or zero · 正数、负数还是零
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version. · 此页面需较新浏览器(支持 SharedArrayBuffer)。请升级 Chrome、Edge、Firefox 或 Safari 至最新版本。
This one builds on a lesson you haven't finished yet. Do that lesson first: · 此任务基于您尚未完成的课程。请先完成以下课程:
Python Basics · Python 基础 · Making decisions · 做出判断 →
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。
n is -4. Print positive, negative or · 或 zero — whichever n is. · n 是 -4。根据 n 的情况,打印 positive、negative 或 zero。
Click Run to see the output here. · 点击“运行”查看此处输出。