Skip to content

Commit 190ffdb

Browse files
committed
change base implementation
1 parent bf515d0 commit 190ffdb

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

tests/test_count_even.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@
33

44
def count_even(arr: list[int]) -> int:
55
"""Count the number of even numbers in an array."""
6-
even = 0
7-
for num in arr:
8-
if num % 2 == 0:
9-
even += 1
10-
return even
6+
return sum(1 for i in arr if i % 2 == 0)
117

128

139
# Your tests can also be benchmarks

0 commit comments

Comments
 (0)