Let $(X,d)$ be a metric space with the property that for every continuous function $f : X \to \mathbb{R}$ it satisfies property P:
Property P: For every $\epsilon >0$ there exists $\delta >0$ such that if $A \subseteq X$ is such that $diam(A)<\delta$ then there exists a finite $B \subseteq \mathbb{R}$ such that for every $a \in A$ there exists $b \in B$ such that $f(a) \in (b-\epsilon, b + \epsilon)$.
Prove:
(1) That every closed subspace $Y \subseteq X$ has property P.
(2) X is complete.
I managed to solve two additional sub-exercises which are:
(i) If the codomain was some other metric space $Y$ instead of $\mathbb{R}$, then every cauchy sequence in $X$ maps to a sequence in $Y$ that has a cauchy subsequence.
(ii) Given any continuous $f : X \to \mathbb{R}$, and $\epsilon>0$ the open cover $\{f^{-1}((q-\epsilon,q+\epsilon)):q\in\mathbb{Q}\}$ has a weak lebesgue number.
But I'm not able to leverage them to solve either of the above.
I am especially confused about (1) above. It seems to me that the only way you could prove it is to extend an arbitrary continuous function $f: Y \to \mathbb{R}$ to some continuous function on $X$, but I'm pretty sure that can't be done unless you have some additional assumptions on $X$ like normality.