Pattern: digit/string scan
Move: Convert number to string → count "0" → if count is odd, increment answer.
Mistake to avoid: Do not overthink. This is just scan/count/rule.
def odd_zero_counter(input_array):
count = 0
for num in input_array:
odd_zero = str(num).count("0")
if odd_zero % 2 == 1:
count += 1
return count
input_array = [20, 11, 10, 10070, 7]
odd_zero = odd_zero_counter(input_array)
print(f"odd zero count: {odd_zero}")
Expected Output
odd zero count: 3
Pattern
Digit/string scan:Convert each number to a string.
Count "0".
If the zero count is odd, increment the result.
Tests: [20, 11, 10, 10070, 7] -> 3 [100, 5, 70] -> 1 [] -> 0
