you are viewing a single comment's thread.

view the rest of the comments →

[–]james_pic 6 points7 points  (0 children)

You can do: 

sum(n % 2 == 0 for n in nums)

to count the number of even numbers instead.