Even or odd · 奇数还是偶数
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
Even or odd
n is 7. Print even when n divides by 2 with no remainder, and odd otherwise.
% gives the remainder. 7 % 2 is 1, 8 % 2 is 0. Compare it with == (two equals signs) — one equals sign means store a value, and Python will tell you so.
中文
奇数还是偶数
n 是 7。当 n 除以 2 没有余数时打印 even,否则打印 odd。
% 给出余数。7 % 2 是 1,8 % 2 是 0。用 ==(两个等号)来比较 —— 一个等号是赋值的意思,Python 会提醒你。
n is 7. Print even when n divides by 2 with no remainder, and odd otherwise. · n 是 7。当 n 除以 2 没有余数时打印 even,否则打印 odd。
Click Run to see the output here. · 点击“运行”查看此处输出。