Question: how many electrons does magnesium have in its valence shell?
Answer: The electron configuration for magnesium is \begin{align*}1s^22s^22p^63s^2\end{align*}. The outer energy level for this atom is n = 3, and it has two electrons in this energy level. Therefore, magnesium has two valence electrons.