First of all, I agree with @Aaron Stevens answer. The work done moving horizontally has to be equal to the force in the horizontal direction times the horizontal distance through which the force acts. But you still might ask, why doesn’t gravity matter? Why did the teacher include gravity?
Surely, every stride we do when running requires us to push off the ground. This requires effort to lift us off the ground, and certainly the expenditure of energy, on our part. And the heavier we are, the more effort. Unfortunately, that effort doesn’t result in actual work being done in the horizontal direction.
A similar situation exists when looking at the work done in elevating ourselves in the gravitational field. We can take a ladder and reach a height $h$ above the surface of the earth and the work we do is $mgh$. If, however, instead of taking the ladder, we walk around a large diameter spiral staircase so that we take many more steps to reach the same height $h$, it may feel like a lot more work, but the actual work done will be the same, $mgh$.
Bottom line, I think the teacher may be confusing physical effort with mechanical work done. They are not always the same.
Hope this; in addition to @Aaron Stevens answer, helps.