Skip to content · ⁨Saltar al contenido⁩

Even or odd · ⁨Par o impar⁩

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.

Español

Par o impar

n vale 7. Imprime even cuando n se divide por 2 sin residuo, e odd en caso contrario.

% da el residuo. 7 % 2 es 1, 8 % 2 es 0. Compáralo con == (dos signos de igual): un solo signo significa almacenar un valor, y Python te lo indicará.

Log in or create account · ⁨Iniciar sesión o crear cuenta⁩

IGCSE, A-Level & AP