Sometimes things look trivial but they're not, so it can pay to be formal.
Recall, then, that
A random variable is a measurable real-valued function defined on a probability space $(\Omega, \mathfrak{F}, \mathbb{P})$ and
$L^2$ is the completion of the space of square-integrable random variables.
The question then is whether for every $y\in\mathbb{R}$ it is the case that the constant function
$$\lambda_{y}: \Omega\to \mathbb{R};\quad \lambda(y)(\omega) = y\text{ for all }\omega\in\Omega$$
satisfies these requirements and whether the set of such functions is a closed vector subspace.
(BTW, axioms of set theory guarantee that such functions exist: as sets, they are $$\lambda_y = \Omega \times \{y\} \subset \Omega \times \mathbb{R}$$ and all axiomatic set theories assure the existence of finite Cartesian products.)
First, $\lambda_y$ is measurable because with respect to any given $y$ there are only two kinds of Borel sets in $\mathbb{R}:$ those that contain $y$ and those that do not. The inverse image of $\lambda_y$ applied to a Borel set is therefore either $\Omega$ or empty. But it is axiomatic that those two sets belong to any sigma algebra on $\Omega.$ Thus, by definition, every $\lambda_y$ is measurable.
Second, we may compute the $L^2$ norm of $\lambda_y$ as
$$||\lambda_y||_2^2 = \int_\Omega |\lambda_y(\omega)|^2 \mathrm{d}\mathbb{P}(\omega).$$
Because integration is linear and $\lambda_y$ is constant, it factors out of the integral. The result is
$$|y|^2 \int_\Omega \mathrm{d}\mathbb{P}(\omega) = |y|^2(1) = |y|^2$$
because (also axiomatically) the probability measure $\mathbb{P}$ integrates to unity. Taking square roots we obtain
$$||\lambda_y||_2 = \sqrt{|y|^2} = |y| \lt \infty$$
for all $y.$
Note that we needed $\mathbb P$ to be a finite measure. It perhaps is the key observation. For instance, the nonzero constant functions are not in $L^2(\mathbb{R})$ with respect to Lebesgue measure, because their integrals all diverge.
Finally, it is immediate from the definition that for all real numbers $x,y,a,b$,
$$a\lambda_x + b\lambda_y = \lambda_{ax+by}$$
because when either side is applied to any $\omega\in\Omega,$ they produce the same value $ax+by.$ This shows the set of $\lambda_y$ is closed under finite linear combinations. Furthermore, this set clearly is finite dimensional: any singleton $\{\lambda_y\}$ for $y\ne 0$ is a basis, because for all real numbers $x,$ the Commutative Law of Multiplication asserts $yx=xy,$ which upon dividing both sides by $y$ can be restated as
$$\lambda_x = (y^{-1}x)\lambda_y.$$
Consequently the constant functions are a closed linear (finite-dimensional) subspace of $L^2(\Omega, \mathfrak{F}, \mathbb{P}).$