I'm going to assume your true question is finding an answer that you do not consider "cheating."
Question/Problem
Find a function $f:\mathbb{R}\to\mathbb{R}$ such that $f$ is discontinuous at each point in $K\overset{\text{def}}{=}\{\frac{1}{n}:n\in\mathbb{N}\text{ and }n\ne 0\}\cup\{0\}$ and $f$ is continuous at each point in the complement of $K$ which is denoted $(\mathbb{R}\setminus K)$
General Answer
Let $g:\mathbb{R}\to\mathbb{R}$ be an arbitrary continuous function. Let $\epsilon>0$ be an arbitrary positive real number.
Your edited answer has $g$ be the zero function and $\epsilon$ be $1$
Define $f:\mathbb{R}\to\mathbb{R}$ by $$f(x)=\begin{cases} g(x)+\epsilon&\text{if }x\in K\\ g(x)&\text{if }x\in(\mathbb{R}\setminus K) \end{cases}$$ for every $x\in\mathbb{R}$ where $K\overset{\text{def}}{=}\{\frac{1}{n}:n\in\mathbb{N}\text{ and }n\ne 0\}\cup\{0\}$.
The reason why I introduce "$K$" is because this method can be used for any given nowhere dense set $K$ where you want discontinuities. The set you were given is not special in any way for this problem. However it is a classic example of a compact set, but that's not relevant to your problem. The set you were given is not special in any way for this problem. However it is a classic example of a compact set, but that's not relevant to your problem.