We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2e51b04 commit 7624d46Copy full SHA for 7624d46
1 file changed
tests/test_count_even.py
@@ -3,7 +3,11 @@
3
4
def count_even(arr: list[int]) -> int:
5
"""Count the number of even numbers in an array."""
6
- return sum(1 for x in arr if x % 2 == 0)
+ even = 0
7
+ for num in arr:
8
+ if num % 2 == 0:
9
+ even += 1
10
+ return even
11
12
13
# Your tests can also be benchmarks
0 commit comments