How to find the Mean of two different variables

Hi, So I'm trying to find the mean score that males got in a math quiz. Males are under a column called gender and are mixed in with females and math score is under a different column. I'm unsure on how to find just the mean score for males only. I can find the mean score normally by using the mean function but am unsure on how to get the female values out of it. I am using R-studio not R if this makes a difference. Help really appreciated!!!!!

Wouldn't the same code work for females?

Can you provide a reproducible example?

In addition to @williaml's advice, if you aren't using R what are you using?