def count_evens(values: List[List[int]]) -> List[int]:
"""Return a list of counts of even numbers in each of the inner
lists
of values.
>>> count_evens([[10, 20, 30]])
[3]
>>> count_evens([[1, 2], [3], [4, 5, 6]])
[1, 0, 2]
"""
from typing import * def count_evens(values: List[List[int]]) -> List[int]: """Return a list of counts of even numbers in each of the inner lists of values. >>> count_evens([[10, 20, 30]]) [3] >>> count_evens([[1, 2], [3], [4, 5, 6]]) [1, 0, 2] """ even_counts = [] for value_list in values: count = 0 for n in value_list: if n % 2 == 0: count += 1 even_counts.append(count) return even_counts
Get Answers For Free
Most questions answered within 1 hours.