Count a value · Contar un 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 una aparición
Contar cuántas veces aparece un valor en una lista.
Recorrer la lista y comparar cada elemento con target. Es el patrón del contador nuevamente, con la condición item == target, y funciona tanto para palabras como para números.
Write count_value(items, target) that returns how many times target appears in items, without using .count(). · Escribe count_value(items, target) que devuelva cuántas veces aparece target en items, sin usar .count().
Click Run to see the output here. · Haz clic en Ejecutar para ver la salida aquí.