Characterising continuous maps between metric spaces Let $f:(X,d)\to (Y,\rho)$. 
Prove that $f$ is continuous if and only if $f$ is continuous restricted to all compact subsets of $(X,d)$. 
I could do the left to right implication but couldn't do the reverse implication.
Please help. 
Thanks in advance!!!

Just as @Siminore pointed out in comments.
To be more precise:
assume that $f$ is continuous on every compact subset of $X$.
Suppose that a sequence $x_n$ of elements of $X$ is such that $x_n\rightarrow x$ for some $x\in X$. 
Observe that a set $\{x_n:n\in\mathbb{N}\}\cup\{x\}$ is a compact subset of the space $X$. Thus, along our assumption, $F$ is continuous on that set and it does simply means, that $f(x_n)\rightarrow f(x)$. Since the choice of a sequence was arbitrary we have proved that $f:X\rightarrow Y$ is a continuous function. Q.E.D.
