Let the total number of seventh grade students be x
Let the number of seventh grade students taking advanced math be k
3/8 of x were taking advanced math at the beginning of the year, i.e
[tex]\frac{3}{8}\text{ of x}=\frac{3}{8}\times x=\frac{3x}{8}[/tex]7 students dropped out by the end of the year, i.e
[tex]\frac{3x}{8}-7=k[/tex]If there were 140 students taking advanced math at the end of the year
[tex]k=140[/tex]Substitute 140 for k into the derived expression to find x
[tex]\begin{gathered} \frac{3x}{8}-7=k \\ \frac{3x}{8}-7=140 \\ \text{Collect like terms} \\ \frac{3x}{8}=140+7 \\ \frac{3x}{8}=147 \\ \text{Crossmultiply} \\ 3x=147\times8 \\ 3x=1176 \\ \text{Divide both sides by 3} \\ \frac{3x}{3}=\frac{1176}{3} \\ x=392 \end{gathered}[/tex]Hence, the total number of seventh grade students there is 392