#206 · Python idioms · Beginner · 25 XP · about 3 min
Write even_squares(nums) that returns a list of the squares of the even numbers in nums, in the order they appear. Odd numbers are left out, and zero and negative even numbers count as even.
Try to write it as a single list comprehension.
even_squares([1, 2, 3, 4]) # returns [4, 16] even_squares([-2, -1, 0]) # returns [4, 0] even_squares([1, 3, 5]) # returns []
First solves only, ranked by stars and then time.