I am trying to solve the following problem.
Let $X$ be locally compact Hausdorff and $Y$ be Hausdorff.
(a) If $f: X \to Y$ is continuous and open map then show that $f(X)$ is locally compact.
(b) If $f: X \to Y$ is onto continuous and open map then show that for any compact subset $K$ of $Y$ there is a compact subset $C$ of $X$ such that $f(C)=K$.
I have solved (a), for (b) I thought I could solve it straightforwardly by using the fact that $f(f^{-1}(K))=K$ since $f$ is onto and show that $C=f^{-1}(K)$ is compact in $X$ but as shown in the below picture I have confronted a problem. So I've thought about using the result in (a) but my efforts have been unsuccessful so far. Can anyone help me?

For every $x\in f^{-1}(K)$, consider an open neighborhood $U_x$ of $x$, with compact closure. Then $f(U_x)$ is open and the family $\{f(U_x):x\in f^{-1}(K)\}$ is an open cover of $K$. Then $$ K\subseteq f(U_{x_1})\cup f(U_{x_2})\cup\dots\cup f(U_{x_n}) $$ for some $x_1,\dots,x_n\in f^{-1}(K)$. Take $$ C=(\overline{U_{x_1}}\cup \overline{U_{x_2}}\cup\dots\cup\overline{U_{x_n}})\cap f^{-1}(K) $$