Count a value · Contar um valor
Count a value
Count how often one value appears in a list.
Loop over the list and compare each item with target. It is the counter pattern again, with the condition item == target, and it works for words as well as numbers.
Contar um valor
Conte quantas vezes um valor aparece em uma lista.
Percorra a lista e compare cada item com target. É novamente o padrão do contador, com a condição item == target, e funciona tanto para palavras quanto para números.
Write count_value(items, target) that returns how many times target appears in items, without using .count(). · Escreva count_value(items, target) que retorna quantas vezes target aparece em items, sem usar .count().
Click Run to see the output here. · Clique em Executar para ver a saída aqui.