Even or odd · Par o impar
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.
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á.
n is 7. Print even when n divides by 2 with no remainder, and odd otherwise. · n es 7. Imprime even cuando n se divide por 2 sin residuo, e odd en caso contrario.
Click Run to see the output here. · Haz clic en Ejecutar para ver la salida aquí.