Skip to content · ⁨Passer au contenu⁩

Even or odd · ⁨Pair ou impair⁩

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.

Français

Pair ou impair

n vaut 7. Afficher even lorsque n est divisible par 2 sans reste, et odd sinon.

% donne le reste. 7 % 2 vaut 1, 8 % 2 vaut 0. Comparer avec == (deux signes égal) — un seul signe égal signifie stocker une valeur, et Python vous le dira.

Log in or create account · ⁨Se connecter ou créer un compte⁩

IGCSE, A-Level & AP