Skip to content · ⁨본문 바로가기⁩

Even or odd

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.

Log in or create account · ⁨로그인 또는 계정 만들기⁩

IGCSE, A-Level & AP