Skip to content

Even or odd · ⁨奇数还是偶数⁩

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 会提醒你。

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

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