Proving that a function is continuous I am asked to find a function $f:\mathbb{R}\to\mathbb{R}$ that is discontinuous on the set $A$= {$\frac{1}{n}: n\in\mathbb{N}$ } but also continuous on the complement of $A$. 
This is what I proposed: 
$f(x) =
\begin{cases}
x &\text{if $x\in A$}\\ 
0 &\text{if $x\notin A$} \\
\end{cases}$.
Now, I am trying to prove this is continuous on $A^c$, but I am not sure what to take for my $\delta$. In this case would taking $\delta=\epsilon$ be okay? In this case we would have $c\notin A$.
So, Given $\epsilon > 0$, take $\delta = \epsilon$.
Suppose $|x-c|<\delta$.
Then, $|x-c|<\epsilon$.
 A: If $x= 0$, then yes, $\delta = \epsilon$ would work. This is because if $|x| < \delta$, then $|f(x)| \leq |x| < \delta = \epsilon$ ($|f(x)| \leq |x|$ follows from the fact that $f(x) =0$ or $f(x)=x$ for all $x$).
In the other cases, I don't think it works. Let $x \neq 0 \in A^c$. Then, $f(x) = 0$. So we would like $|y-x| < \epsilon$ to imply that $|f(y)| < \epsilon$. However, this would not be true. For example, if $x = .99$ and $\epsilon = 0.5$, we would be tempted to think that if $|y-x| < 0.5$  then $|f(y)| < .5$. However, the above is violated with $y = 1$.
So, the $\delta$ to take in such a case would be the following : for all such $x$, there is a ball of some fixed radius around $x$, which does not intersect $a$. Let $\delta$ be the radius of this ball, then this $\delta$ works for all $\epsilon$. It is therefore dependent on $x$, but not on $\epsilon$.
EDIT : Should mention, your candidate is the correct answer i.e. this function is continuous on $A^c$ and discontinuous on $A$. The only question is as to the relation between $\delta$ and $\epsilon$ now, but the edit is merely for completeness.
A: Consider $x_{0}>1$, take $\delta<\min\{\epsilon,x_{0}-1\}$. For $x_{0}\in(1/(n+1),1/n)$, take $\delta<\min\{\epsilon,1/n-x_{0},x_{0}-1/(n+1)\}$.
For $x_{0}<0$, take $\delta<\min\{\epsilon,|x_{0}|\}$. For $x_{0}=0$, we can take $\delta=\epsilon$.
