In theory and generally speaking and most things being equal . . . a whacking will be more painful when delivered by a male than when delivered by a female.
In the real world, however, we have a multitude of variables not least significant of which are the psychological ones.
In nature, males are programmed to attack other males and to be as nice as pie to females. Also, men are programmed by society to believe that hitting women is at worst terribly wrong and at best nothing to be proud of. Also, male teachers just love to be liked by schoolgirls. All those factors will tend to soften the blow, so to speak.