(N/A) diatomic gas molecule like $O_{2}$,$N_{2}$,$H_{2}$,or $CO$ has three translational degrees of freedom corresponding to motion along the $x$,$y$,and $z$ axes.
$E_{t} = \langle \frac{1}{2} m v_{x}^{2} \rangle + \langle \frac{1}{2} m v_{y}^{2} \rangle + \langle \frac{1}{2} m v_{z}^{2} \rangle$
Additionally,it possesses two $(2)$ rotational degrees of freedom,as shown in the diagram. For a diatomic molecule,there are two independent rotational motions about axes perpendicular to the interatomic axis.
Let $\omega_{1}$ and $\omega_{2}$ be the angular speeds about axes $1$ and $2$,and $I_{1}$ and $I_{2}$ be the moments of inertia about these axes.
The total energy of the molecule is the sum of translational and rotational kinetic energy $(KE)$:
$E = E_{t} + E_{r}$
$E = \langle \frac{1}{2} m v_{x}^{2} \rangle + \langle \frac{1}{2} m v_{y}^{2} \rangle + \langle \frac{1}{2} m v_{z}^{2} \rangle + \langle \frac{1}{2} I_{1} \omega_{1}^{2} \rangle + \langle \frac{1}{2} I_{2} \omega_{2}^{2} \rangle$
Here,there are $3$ terms for translational $KE$ and $2$ terms for rotational $KE$,resulting in a total of $5$ degrees of freedom at room temperature.
At high temperatures,these molecules also exhibit a vibrational mode. The atoms oscillate along the interatomic axis like a one-dimensional harmonic oscillator,contributing two additional degrees of freedom (one for kinetic energy and one for potential energy),making the total $7$ degrees of freedom.