Example 5 (2005 National High School Mathematics League Test Question) Define the function $f(k)=\left\{\begin{array}{l}0, k \text { is a perfect square } \\ {\left[\frac{1}{\{\sqrt{k}\}}\right], k \text { is not a perfect square, }}\end{array}\right.$ Find $\sum_{k=1}^{240} f(k)$.