[proofplan]
For separability of $L^p$ ($1 \leq p < \infty$), we construct a countable dense subset by approximating $L^p$ functions in three stages: by simple functions, then by simple functions supported on rational-endpoint boxes, then by rational-coefficient combinations. For $L^\infty$, we exhibit an uncountable family of indicator functions mutually separated by distance $1$.
[/proofplan]
[step:Construct a countable dense subset of $L^p$ for $1 \leq p < \infty$]
Define
\begin{align*}
\mathcal{D} = \left\{\sum_{j=1}^m q_j\, \mathbb{1}_{R_j} : m \in \mathbb{N},\; q_j \in \mathbb{Q},\; R_j \text{ a box with rational endpoints}\right\}.
\end{align*}
This is countable.
[claim:Simple Functions Are Dense]
For every $f \in L^p(\mathbb{R}^n)$ and $\varepsilon > 0$, there exists $g \in \mathcal{D}$ with $\|f - g\|_{L^p} < \varepsilon$.
[/claim]
[proof]
Approximate $f$ by a simple function $s = \sum a_j \mathbb{1}_{E_j}$ with $\|f - s\|_{L^p} < \varepsilon/3$.
For each $E_j$ with finite measure, regularity of Lebesgue measure provides a finite union $V_j$ of rational-endpoint boxes with $\mathcal{L}^n(E_j \triangle V_j) < \delta$.
Replacing each $a_j$ by a rational $q_j$ with $|a_j - q_j|$ small, the resulting $g = \sum q_j \mathbb{1}_{V_j} \in \mathcal{D}$ satisfies $\|s - g\|_{L^p} < \varepsilon/3$.
By the triangle inequality, $\|f - g\|_{L^p} < \varepsilon$.
[/proof]
For open $U \subseteq \mathbb{R}^n$, the same argument applies with boxes contained in $U$.
[/step]
[step:Show $L^\infty(0,1)$ is not separable]
[claim:L Infinity Not Separable]
$L^\infty(0, 1)$ is not separable.
[/claim]
[proof]
For each $t \in (0, 1)$, define $f_t = \mathbb{1}_{(0, t)}$.
For $s < t$: $\|f_t - f_s\|_{L^\infty} = \|\mathbb{1}_{(s, t)}\|_{L^\infty} = 1$.
The uncountable family $\{f_t\}_{t \in (0,1)}$ has pairwise distance $1$.
If $D$ were a countable dense subset, the pairwise disjoint balls $B(f_t, 1/3)$ would each require a distinct element of $D$, forcing $D$ to be uncountable.
[/proof]
[/step]