Praise be to Allah.
We put this question ( What should medical students do in lectures given by female teachers?) to Shaykh ‘Abd-Allaah ibn Jibreen (may Allaah preserve him), who replied as follows:
People like these students have no other option, so they have to try hard to lower their gaze, protect themselves and keep away from temptation which could lead them into haraam actions. If he notices that he is starting to slip towards something haraam, he should stop attending the lecture.
And Allaah is the Source of strength.