Had trouble with the list comprehension part.

Went ahead and did it with a loop. Couldn't get the different syntax to work using a list comprehension for avgAgeByGender.
Using a list comprehension here is only slightly more complicated... you can use "if" conditions at the end of the list comprehension. Here's an unrelated example... run this code and wrap your mind around what it's doing, and then you'll have a good idea for how to use one here:

[i*2 for i in range(21) if i % 2 == 0]