In 1989, seventeen-year-old Mike O'Donnell (Zac Efron) learns during the start of his high school championship basketball game that his girlfriend Scarlet Porter (Allison Miller) is pregnant. Moments after the game begins, he leaves the game and goes after Scarlet, abandoning his hopes of going to college and becoming a professional basketball player.
Two decades later, Mike (Matthew Perry), now thirty-seven years old, finds his life stalled. Scarlet (Leslie Mann), now his wife and mother of their two children, has separated from him due to his blaming her for his regrets about abandoning his future, forcing him to move in with his geeky, yet extremely wealthy, best friend since high school, Ned Gold (Thomas Lennon). At his job, there comes another reason for his frustration: due to his lack of higher education and since he is significantly older than most of his co-workers, he is passed over for a promotion he deserves in favor of a much younger worker. He quits his job and his high school-age children, seventeen-year-old Maggie (Michelle Trachtenberg) and sixteen-year-old Alex (Sterling Knight) want nothing to do with him. Later, while visiting his high school to reminisce, an encounter with a mysterious janitor (Brian Doyle-Murray) transforms Mike back into his seventeen-year-old self.
Mike then enrolls in high school posing as Mark Gold, Ned's son, and plans to go to college with a basketball scholarship. As he befriends his bullied son and discovers that his daughter has a boyfriend, Stan (Hunter Parrish), who does not respect her and frequently torments Alex, Mike comes to believe that his mission is to help them. He meets Stan, the captain of the basketball team, and embarrasses him in front of the whole school after Stan insults Alex. Later, in Sex Education class while the teacher is handing out condoms to the students in a basket, Stan turns to Mike and refuses to give him any, saying that he does not need them, causing quiet laughter among the class. Mike then makes a speech about love and sex in front of the whole class for Maggie's benefit, causing all of the girls to give back their condoms. Stan then takes the condoms claiming that he is stocked up for the weekend and kisses Maggie passionately. Because of this, Mike loses his temper and starts a fight with Stan on the floor, which is being taped by other students and eventually goes viral within a matter of minutes. Mike loses the fight and Ned is called up to the school.
Mike comforts Maggie when Stan dumps her after she refuses to sleep with him. With Mike's help, Alex overcomes Stan's bullying to obtain a place with Mike on the basketball team and the girlfriend he desires.
Through their children, Mike spends time with Scarlet, who is attracted to his remarkable resemblance to her husband in high school. Mike has difficulty resisting his desire for her despite the relationship's clear inappropriateness. Mostly Scarlett usually turns down his attractions, because of his youthful appearances. At the same time, he must fend off Maggie's sexual advances.
Mike soon realizes that Scarlet is the best thing that ever happened to him and finally realizes that his own selfishness has driven his family away. He tries to re-unite with her, briefly forgetting his young form and kisses her during a party, in front of Maggie and other girls, and unsuccessfully explains to her that he is actually her husband. On the day of the court hearing to finalize Scarlet and Mike's divorce, Mike makes one last attempt to win her back (as Mark) by reading a supposed letter from Mike. He states that although he couldn't set things right in the beginning of his life, it doesn't extinguish the fact that he still loves her. He also explains that even though he still wants to be with her, he should let her move on. After he exits, Scarlet notices that the "letter" is actually the directions to the courtroom and she begins to grow curious. As a result, she postpones the divorce by a month. During a high school basketball game, Mike reveals himself to Scarlet. As Scarlet once again runs away down the hall, Mike decides to chase her down once more, but not before handing the ball off to his son. Mike is then transformed back into his thirty-seven-year-old self, and reunites with Scarlet.
The film ends with Mike receiving the gift of a whistle from Ned in celebration of his new job as the high school's basketball coach after Coach Murphy.

Question: What did all the girls do in Sex Education class?
Answer: gave back their condoms
Alternative answer: Return the condums