Even or odd · Par ou ímpar
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 ou ímpar
n é 7. Imprima even quando n for divisível por 2 sem resto, e odd caso contrário.
% dá o resto. 7 % 2 é 1, 8 % 2 é 0. Compare com == (dois sinais de igual) — um sinal de igual significa armazenar um valor, e o Python avisará.
n is 7. Print even when n divides by 2 with no remainder, and odd otherwise. · n é 7. Imprima even quando n for divisível por 2 sem resto, e odd caso contrário.
Click Run to see the output here. · Clique em Executar para ver a saída aqui.