For answering this, look carefully into the code again.
In the first step, Sum has been initialized to 0.
In the next step, we compare the gender in the card and the parameter; if they compare equal, then math marks are added to Sum, otherwise, Sum is left as it is (at 0).
In our case, none of the cards have Z as gender, so it doesn't compare equal for any card, and Sum doesn't get updated for any card. It remains 0.
Finally, it returns the current value of Sum (0) for every card.