Prove that a function between metric spaces $(X,d_{X})$ and $(Y,d_{Y})$ is continuous iff the pre-image of open sets is open

Assume b)

Let $\epsilon\gt 0$ and $x\in X$. The ball $B(f(x),\epsilon)\subset Y$ is an open subset. Its reciprocal image $f^{-1}\left(B(f(x),\epsilon\right)$ is open. But $x\in f^{-1}\left(B(f(x),\epsilon\right)$ so there is an open ball centred at $x$ included in this open subset. This means there is a $\delta\gt 0$ such that $B(x,\delta)\subset f^{-1}\left(B(f(x),\epsilon\right)$. We have just proved that

$$\forall x\in X\,\forall \epsilon\gt 0\,\exists \delta\gt 0,\,d_X(x,y)\leq \delta\Rightarrow d_Y(f(x),f(y)\leq \epsilon$$

For the other implication assume a) $f$ continuous

Consider $V\subset Y$ an open subset. Let $x\in f^{-1}(V)$; this means $f(x)\in V$. Take $\epsilon \gt 0$ such that $B(f(x),\epsilon)\in V$. Because of the assumption there exists $\delta\gt 0$ such that

$$y\in B(x,\delta)\Rightarrow f(y)\in B(f(x),\epsilon)$$

This means

$$B(x,\delta)\subset f^{-1}\left(B(f(x),\epsilon\right)\subset f^{-1}(V)$$

And we have juste proved that $f^{-1}(V)$ is open