Skip to content · ⁨Pular para o conteúdo⁩

Keep the evens · ⁨Manter os pares⁩

English

Keep the evens

Filter a list: keep some items and leave the rest out.

Start with an empty list, loop over nums, and .append() each number that passes the test n % 2 == 0. Return the new list after the loop has finished.

Português

Manter os pares

Filtre uma lista: mantenha alguns itens e exclua os demais.

Comece com uma lista vazia, percorra nums, e .append() cada número que passar no teste n % 2 == 0. Retorne a nova lista após o loop terminar.

Log in or create account · ⁨Entrar ou criar conta⁩

IGCSE, A-Level & AP